FAQ: Code Challenges: JavaScript Fundamentals - sillySentence()

This community-built FAQ covers the “sillySentence()” exercise from the lesson “Code Challenges: JavaScript Fundamentals”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

FAQs on the exercise sillySentence()

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Why would they want me to do it exactly their way? i literally coded my own good function working all well and its wrong because it wasnt made their way lol

4 Likes

looking at the tests for that exercise, it only appears to test behaviour. Maybe your code behaved slightly incorrectly.

Here’s my code I used for this and it’s not working…any suggestions?

const sillySentence =(input1, input2, input3) => {
return I am so ${input1} because I ${input2} coding! Time to write some more awesome ${input3};
}

Never mind, they wanted me to change my variables names to what they have. Thanks any way

They… don’t.
You probably changed something else as well (the code you shown won’t produce the right string)

Hi Team… I’m new and while the result gets printed cleanly on my screen- Its still appearing as wrong? Any ideas?

function sillySentence (adjective, verb, noun) { return I am so ${adjective} because I ${verb} coding! Time to write some more awesome ${noun}!;} I have tried variable name changes, using const syntax versus function. Any variation gives me the printed result on the screen, but still asks if i have used string concatenation or string interpolation?

Don’t bother! Poor marking team! Why should i have to call them String1, String2, String3?

2 Likes

Same here! I wrote the following …

<function sillySentence (adjective, verb, noun) {
return I am so ${adjective} because I ${verb} coding! Time to write some more awesome ${noun};
}; />

And it worked fine but I got an error message asking if I’d used string concatenation or interpolation …

1 Like

the name of the parameters do not matter. Just make sure your string prints out exactly what they have, how they have it; spaces, caps, punct’s and all.

I resorted to utilizing the solution help and see that my struggle was due to confusion over:

  1. when to omit the curly brackets (i.e. at the the end of line one)
  2. when to omit return

Is this because there are three parameters? Or? Any clarification would be appreciated.

const sillySentence = (adjective, verb, noun) =>
I am so ${adjective} because I ${verb} coding! Time to write some more awesome ${noun}!

console.log(sillySentence(‘excited’, ‘love’, ‘functions’));

1 Like

your code works fine you just need a curly brace just after the arrow and at the end of your sentence.

  • you need to put return before your sentence and dont forget to put ` instead of ’ at the beginning and the end of your sentence

So my code works perfectly, and I used interpolation.

const sillySentence = (adj,verb,noun) => {
  return `I am so ${adj} because I ${verb} coding! Time to write some more awesome ${noun}`;
}

But Codecademy keeps marking it wrong and hitting me with this error/question:

Did you use string concatenation or interpolation to fill in the blanks of this sentence: ‘I am so __ because I ___ coding! Time to write some more awesome ___ !’?

What gives here?

this wat i coded . it seems correct as i go over and over some references but it still shows error. i need ur help pls

it should have been

const sillySentence = (adjective,verb,noun) =>{
I am so ${string1} because I ${string2} coding! Time to write some more awesome ${string3}!;
}

as while declaring the function you make use of variable name, then call it by un-commenting the console.log() text in the probelm

Copy paste error and replace the __ with ${variable}, cuz this error is occurring when something is missing in the sentence …be it additional space or anything.

function sillySentence(string1,string2,string3){

return I am so ${string1} because I ${string2} coding! Time to write some more awesome ${string3}!;

}

use this one

const sillySentence = (adjective, verb, noun) => {
return ‘I am so ’ + adjective + ’ because I ’ + verb + ’ coding! Time to write some more awesome ’ + noun +’!’;
};

console.log(sillySentence(‘excited’, ‘love’, ‘functions’));

1 Like

Welcome @osasinfo! So glad you’re here at Codecademy and happy to see you participating in the discussion forums. Awesome!

Just fyi, to include code most effectively in your posts, use the code formatter, i.e., </>

image

this is the right code ,pay attention to the details in particular (!) at the end
const sillySentence =(adjective,verb,noun)=>{

return 'I am so ’ + adjective + ’ because I ’

  • verb + ’ coding! Time to write some more awesome ’ + noun +’!’;

}

console.log(sillySentence(‘excited’, ‘hate’, ‘functions’));

Did you include the back ticks too?