Please Help!


#1

}

it tells me that tehre is an error "Oops, try again. It looks like you didn't print the correct string. Check your condition in the if statement, and your console.log statements.
"

Replace this line with your code. 

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!");


}


#2

The only problem with your code is the indentation of your else body,

should be,

else {
    // Use console.log() to print "Drive safe"
    console.log("Drive safe!");


}

#3

i can't see any difference !


#4

it doesn't work also!


#5

The difference is the indenting and formatting. JS is indent specific. Notice how on your code your backslashes go past the "else" tag, while on the one bandit provided they start at the second e.
It's confusing and irritating at times. Hope I helped :slight_smile:

It appears to work with the proper indentation.


#6

All your code is correct the only difference is the indentation of your code if it is indented like this it should work,

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!");
}

#7

it doesn't work!!!! what should i do!


#8

Post your pre-formatted code with proper indentation so we can see what is still causing the error. :slight_smile:


#9

Try refreshing the browser, and if that doesn't work then copy your code, press reset, and then paste and test it again.


#10

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!");
}

that's the code i wrote and i tried to refresh the browser!


#11

Actually I have found your error you are supposed to use the greater than operator > but instead you are using the greater than or equal to operator >= which is not the same thing,

should just be,

if (speed > 80) { :grin:


#12

it doesn't work also :"D


#13

Looks like your string in logs aren't correct. Try:

...
console.log("Slow down"); // without "!"
...
console.log("Drive safe"); // without "!"

#14

yeah that was the error thanks


#15

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.