Conclusion


#1

numRand = (Math.floor(Math.random() * ((10-1) + 1)+1))

if numRand = 7 {
"You are Blessed"
}
else numRand < 7{
"Goodluck :/"
}
else if numRand > 7 {
"NOPE NOPE NOPE"
}

soo, its saying there is an unexpected identifier, what's going on? Thanks for the help btw.


#2

Alright let's go back to the basics..

FIRST!!

numRand = (Math.floor(Math.random() * ((10-1) + 1)+1))

is exactly the same as using:

numRand = (Math.floor(Math.random() * 11);

This means any number from 0 up until but not equal to 11.

SECONDLY!!!!!

if numRand = 7 {

I believe you're missing parenthesis in the "IF" statement, also keep in mind you're not assigning the variable a new value "numRand = 7" you're comparing the variable against a value! "numRand == 7" Like so.

if (numRand == 7) {

THIRDLY!!!!!!

else and else if statements!
else if statements must come before "else" statements, else is an all encompassing statement, no matter what else happens, the else statement will catch whatever the if and else if statements don't catch.

AAAAND: because else statements are all encompassing, they don't have a parameter!

else if (numRand > 7) {
"NOPE NOPE NOPE"
}

else { 
 console.log("Goodluck :/");
}

LASTLY!!!!!!!!!!!!!!!!!!

"You are Blessed"
"Goodluck :/"
"NOPE NOPE NOPE"

remember that you need to have the console.log(" "); statement around these. They can't just be left as is.

So they'll look like this:

console.log("You are Blessed");
console.log("Goodluck :/");
console.log("NOPE NOPE NOPE");

I believe those are all the fixes you need, otherwise you should be good to go! :+1:


#3

Thanks, but lolman, it didn't actually fix my problem
"SyntaxError: Unexpected identifier"


#4

Oops, I forgot the parentheses on the else if statement, :joy: