Don't get confused in 1/13


#1

var speed = 65;

// Complete the condition in the ()s on line 4
if (speed === 81) {
// Use console.log() to print "Slow down"
console.log("Slow down");
}
else {
// Use console.log() to print "Drive safe"
console.log("Drive safe");

}


#2

They might not have told you about this yet, but >= means 'greater than or equal to' so instead of 'if (speed === 81)' do if(speed >= 80).


#3

i know about that but to me it seems like its the same, thank you for that advice anyway.


#4

Well >= 80 checks for a range of numbers anything from 80 to the maximum number of JavaScript will fall in this categorie. But === 81 checks for one specific number so in the sense of the exercise a speed of 250 would be fine and you would say "Drive safe" but someone driving exactly 81 would hear "Slow down".


#5

Try var speed = 65;

// Complete the condition in the ()s on line 4
if ("speed" === 80) {
// Use console.log() to print "Slow down"
console.log("Slow down");
}
else {
// Use console.log() to print "Drive safe"
console.log("Drive safe");

}


#6

Is this a solution or a question? Some more informations would be nice.
Also "speed" === 80 doesn't make much as "speed" is a string and 80 number. So rather use speed without the "" to indicate that you want to use the variable which currently contains 65. And think if === is really the comparison operator of choice and it is pretty odd to tell someone with a speed of 80 to slow down but e.g. someone with 250 to "Drive safe"