function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "The " +myNoun+ "ate " +myAdjective+ "and " +myVerb+ "away " +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 6.1; WOW64; rv:65.0) Gecko/20100101 Firefox/65.0.
oh thanks a lot for the reply. i have just tried running the code again, this time with all the spaces included, just like you`ve told me yet the program tells me this;
wordBlanks(“dog”, “big”, “ran”, “quickly”) should contain all of the passed in words separated by non-word characters (and any additional words in your madlib)
i do understand what next to do as i have tried basically all i have been told to in the ‘hints’.
just add + ' ' to each of your arguments
eg. myNoun = myNoun + ' '
fancy way
function foo(some, word) {
// loop though each argument and add a space to the end of it
Object.keys(arguments).map(i => (arguments[i] = arguments[i] + " "));
let result = "this " + some + "is " + word + "good";
return result;
}
foo("cake", "really");
okay. first all, thanks for the reply
the problem i have been having for some hours now has been on the Basic JavaScript challenge, on Word Blanks precisely. I actually am a beginner. I posted the my typed code along with this topic; as i have followed all the instructions given to me on the hints to the best of my understanding and am still not getting my desired result on the challenge. This is what my code looks like:
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = “”;
// Your code below this line
myNoun = “dog”
myAdjective = “big”
myVerb = “ran”
myAdverb = “quickly”
result += “The” +myNoun + “ate” +myAdjective + “and” +myVerb + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks(“The” + “dog” + “ate” + “big” + “and” + “ran” + “away”+ “quickly”);
result += "my " + myNoun + " is very " + myAdjective + " and can " + myVerb + " very " + myAdverb;
I think the spaces might be a little confusing but just be careful next time, let me know if you have any more question.
p.s. you can customise the sentence however way you want, just make sure to include the parameters.
Full code:
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// Your code below this line
var result = "";
result += "my " + myNoun + " is very " + myAdjective + " and can " + myVerb + " very " + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
instead of:
return result += "My " + myNoun + " is quite " + myAdjective + " but it " + myVerb + " so " + myAdverb;
so, i was bascially repeated already declared functions myNoun, myAdjective etc in the return result.
so try to check your code again. my final code nows looks like this:
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// Your code below this line
var result = “”;
// Your code above this line
return result += "My " + myNoun + " is quite " + myAdjective + " but it " + myVerb + " so " + myAdverb;
}
// Change the words here to test your function
wordBlanks(“dog”, “big”, “ran”, “quickly”);