There is a function:
function setPageThread (name, options = {}) { let popular = options.popular; let expires = options.expires; let activeClass = options.activeClass; console.log(name, + " " +, popular, + " " +, expires, + " " +, activeClass); // .... } I give her the parameters:
setPageThread("New version out soon!", { popular: true, expires: 1000, activeClass: "is-page-thread" }); and get the syntax error:
SyntaxError: expected expression, got ','
If I remove spaces, everything works:
console.log(name, popular, expires, activeClass); I just can not figure out how to add a separator, space or character : Still doing the right thing: I write + ' ' + , but for some reason it does not work.
console.log(name + ", " + popular + ", " + expires + ", " + activeClass);- Alexey Shimanskylet, maybe destructuring -let {popular, expires, activeClass} = options;. Or evenfunction (name, {popular, expires, activeClass}) { … }. - Aleksei Zabrodskii