Tell us what’s happening:
So I am trying to ‘parse’ the new variables into the existing, given text, is that right? I tried a few different things but I don’t think I am on the right track for some reason.
Your code so far
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// Your code below this line
var result = "dog, big, ran, quickly";
var sentence = "It was really" + myAdjective + "and we" + myVerb + "ourselves" + myAdverb + ".";
// Your code above this line
return result;
}
// Change the words here to test your function
// function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// var result = ("cat", "little", "hit", "slowly");
// var sentence = "It was really" + myAdjective + "and we" + myVerb + "ourselves" + myAdverb + ".";
// return result;
// }
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.
see the return result in the function? that means that the variable result is the one that counts. which is just four words. so you pass one of the tests because those are also the values of the variables. but not the other, because in the other case your variables have other values but the value of result doesn’t change, as it doesn’t have variables inside.
so for non-variable text a space at the end of string one and then before and after all but the final string (which should be your punctuation and doesn’t require a space before or after)?
I don’t understand this correct solution below. Specifically, why we use “My “+myAdjective+” “+myNoun+” “+myVerb+” very “+myAdverb+”.” and not "My " + myAdjective + myNoun + myVerb + " very " + myAdverb ?
What I missed?
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");