6/7 Asking for feedback SyntaxError: Unexpected Token >


#1

I got a simple code, but it wont work, and ironically enough its the < that wont work, here is my code:

var feedback = prompt("Please rate this game from 0 - 10");
if(feedback = < 8)

{
console.log("Thank you! We should race at the next concert!");
}
else{
console.log("I'll keep practicing coding and racing.");
}


#2

It's not working because you have the assignment operator before the less than sign. if you're checking less than or equal to 8 it'll be <=.

if(feedback < 8) {
    console.log("Thank you! We should race at the next concert!");
}else {
    console.log("I'll keep practicing coding and racing.");
}

#3

OK thanks, but still does not work...


#4

It should be moe than eight not less than eight, so use a > sign instead


#5

the output of prompt is a string.
so you need to compare with a string.

"Try the code it give result."

var feedback=prompt("rate the game");
if(feedback > "8"){
console.log("Thank you! We should race at the next concert!")
}else{
console.log("I'll keep practicing coding and racing.")
}


#6

thanks for the tip but no dice


#7

Hey Guys is it solved? if not, this worked for me. :smile:

var feedback = "Game Rating";
feedback = prompt ("Kindly Rate The Game!")
if (feedback >=8) {
console.log("Thank you! We should race at the next concert!")
}
else
{
console.log("I'll keep practicing coding and racing.")
}


#9

try..
var feedback = prompt("Rate my game")
if (feedback > 8) {
console.log("Thank you! We should race at the next concert!")
}
else {
console.log("I'll keep practicing coding and racing.")
}