How should I check the value of s?

Question

How should I check the value of s?

Answer

s is the argument provided to the function when it is called elsewhere in the program, so it’s just a value that we’re comparing against the strings ”yes” and ”no”.
Be sure you’re not using the function, shut_down(s), in your if or elif conditions being checked, as that’s invalid and will cause it to infinitely call itself. We’re only comparing s, the value passed to the function.

3 Likes

I think it was just a typo and the “s” was outside of “value”, which should have been “values”. Confused me first too, but then I realized it was just a typo.

Why am I seeing this as the community forum linked from Lesson 11, Review Functions, of Javascript Basics Unit: Functions?

12 Likes

For the same reason they think this doesn’t print “Thank you.” three times:

for (let c = 0; c < 3; c++) {
  console.log('Thank you.');
}
3 Likes

I wonder, is there any more concise way in JS to write it?

Something like in Ruby:

3.times {
   puts "Thank you!"
}
2 Likes