Word Blanks: Hey guys i need help, i cant seem to get this right, i have passed all the words into word blanks but its still not right


function wordBlanks(cat, little, hit, slowly) {
  // Your code below this line  
var result = "my " + "dog " + "is " + "big " + "and " + "ran " + "quickly ";
  

  // Your code above this line
  return result;
}

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

see challenge

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/word-blanks

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

  • You should only have changed the code between “Your code below this line” and “Your code above this line”. You changed the function signature.

  • You are not using the argument variables.

1 Like

I have done that severally, still not correct. i am stuck.

What is your current code?

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// Your code below this line
var result = “”;

// Your code above this line
return result;
}

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

This is the current code…
In this challenge, we provide you with a noun, a verb, an adjective and an adverb. You need to form a complete sentence using words of your choice, along with the words we provide.

You will need to use the string concatenation operator + to build a new string, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb. You will then assign the formed string to the result variable.

You will also need to account for spaces in your string, so that the final sentence has spaces between all the words. The result should be a complete sentence.

Hi!
First of all, you don’t need to change the name of variables set by default in this challenge.

It’s said: “You will need to use the string concatenation operator + to build a new string, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb. You will then assign the formed string to the result variable.”

So, the result will contain variables and some words to create a meaningful sentence. all you need is to group variables with strings.

For example:

var noun = "box";
var adjective = "empty";
var result;
result = "This " + noun + " is " + adjective;

So, our result will be “This box is empty”.
Notice that variables must be separated by non-word charachers.
When we try to do this : result = adjective + noun; ( output: emptybox )
we should add a backspace, for example : result = adjective + " " + noun; ( output : empty box. )

Hope that helped.