I took a look at the solution, which is similar to mine but does a concatenation operator at the end with the blank string at the top, and also uses the += operator instead of +. I don’t completely understand these changes, or why my code fails.
You don’t need to set up any new variables (just use result). All of the variables should be passed in using the arguments of the function.
Your function should be something like this:
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) { // These are your variables
// They're set as whatever arguments you pass in to the function
// Don't assign new variables with the same name within the function,
// or you'll break it.
var result = "";
/* Here, you build up `result` into a sentence.
You can either reassign `result` as the full sentence
using `+` to concatenate, or build it up step by
step using `+=` */
return result;
}
Examples of + vs +=
var a = '';
var b = '';
var c = ',';
var d = '!';
a = 'Hello' + c + ' World' + d; // reassigns `a`
b += 'Hello';
b += c;
b += ' World';
b += d; // building up `b` step-by-step
a; // "Hello, World!"
b; // "Hello, World!"
a === b; // true