I found the solution but i m a bit confused

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = “”;
// Your code below this line
result += "i have a “+myAdjective+”, very very big, “+myNoun+”. " + “But he “+myVerb+” off somewhere very “+myAdverb+”.”;

// Your code above this line
return result;

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

This is the correct answer of that challenge, but the only thing that i was doing wrong when i first did it was, i was missing those ‘+’ before and after the vars (if not pls tell me what they really are). So my question is, if var dogName = “bob”; and if i type “My dog’s name is dogName.” won’t the output will be “My dog’s name is bob”? so what is that “+” actually doing?
And Its confusing me.

In your example, in order to show dogName as bob you must write: "My dog’s name is " + dogName + "."
Otherwise the output will just be [My dog’s name is dogName.]

The text inside the quotes are strings, strings will be printed the way they are written. The + operator allows you to concatenate strings and variables together.

1 Like

@baddyspirit No one can see your current solutions except you when viewing the challenge pages. For others to see your code, you will need to copy/paste it as a reply to this thread. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a 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.


1 Like