Word Blanks 2019

Tell us what’s happening:

I tried following the stuff we learned in previous assignments but I am stuck what part has the error?
Also the solutions shows something different in the part that is not supposed to be changed.

Your code so far

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) { 
  // Your code below this line
myNoun = "dog";
myAdjective = "big";
myVerb = "ran";
myAdverb = "quickly";
result+= "My "+myAdjective+" "+myNoun+" "+myVerb+" very "+myAdverb+"."; 

  // Your code above this line
  return result; 

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:

Why are you assigning new values to the arguments? If I want to call the function with these values:

wordBlanks("cat", "small", "walk", "slowly");

it would still return My big dog etc… instead it should return what I pass in the function.
You don’t need to reassign the argument values! (and probably you never should, unless you know you want to.)

Edit: One more thing, you also removed this line var result = "";
You are assigning a string to result but it is not defined!

I already tried erasing and pressing enter. I did not work. That was the first thing I thought was wrong too.

Your issue is that you have reassigned the parameters, so the nmother test that pas in different words does not pass.

When a function has arguments you must not reassign those or the function can’t be reused

This is what pass the words in

result is not declared anymore
You need to change the beginning of that line

var result = ...

Otherwise you have unexpected results

Now I am very confused. I did get the right answer after changing (result+=) to (var result)

 result+= "My "+myAdjective+" "+myNoun+" "+myVerb+" very "+myAdverb+".";

The solution in the assigment given above uses += and the hint also suggests using it. Is there a specific way to know to not use (result+=) or (var result =)

They are differen thing… there are 2 issues here, let’s break it down.

First thing:
result += ... is shorthand for result = result + ...
If you don’t assign a value to result, result is undefined, you can’t sum something to undefined. If result was an empty string (result = "" before you sum), or anything else than it may works.

Second issue, if you don’t declare your variable with var result the variable is global, as you are summing to it, it means that everytime the function is called its value is changed adding things to it. This will make you pass only the first test, and never the following ones.

If you reset the code you will see that the starting code is in fact

var result = ""

OK, I’ve got the same issue as GOBSIYE. I have tried using RESULT = / VAR RESULT +=
Neither works!

BELOW is the LAST UPDATE to the string that other coders have said worked in the past.
However I find it does not now.

Any help would be appreciated !

var result += "I “ran”, with the “big”, goofy , “dog”, very “quickly” ;

When you initialize a variable, the variable didn’t have a value before, so you are adding things to something that doesn’t have a value
You can try writing console.log(result) below that line and see
You can just use the assignment operator, =

Also, your quotes seems in the wrong place, and you are not using the variables and you may want to check again how to concatenate strings

Here is the answer BELOW. The idea is to fill your sentence with WORDBLANK FUNCTIONS, not actual words, then run the FUNCTION to fill in the blanks . . .

function wordBlanks( myNoun, myAdjective, myVerb, myAdverb) {

var result = " " ;

// Your code below this line

result+= "My “+myAdjective+” “+myNoun+” “+myVerb+” very "+myAdverb+ “.” ;

// Your code above this line

return result;


// Change the words here to test your function

wordBlanks(“dog”, “big”, “ran”, “quickly”);

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.