I'm very rusty at JS so I may be messing up my syntax but for some reason else if just won't work. This is the code snippet:
if (command == 'flip') {
console.log("flippin")
var coin = Math.round(Math.random())
if (coin == 1); {
coin = "Tails"
}
else if (coin == 0); {
coin = "Heads"
}
else if (!coin == "1" || !coin == "2"); {
console.log("hey you messed up, coin = ", coin)
coin = "Uh Oh... Something went really really wrong here so I can't help ya here :( blame my dev not me man. Don't worry I already reported this problem to him!"
}
} The error I get is:
SyntaxError: Unexpected token 'else'
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47strong text (The rest of the code is just a discord bot I am working on)
Aucun commentaire:
Enregistrer un commentaire