if(userAnswer==="yes");
just remove the “;”
if(userAnswer==="yes")
Here’s why – JavaScript (and truthfully most languages out there) will interpret the if below:
if (condition);
statement;
as a no-op and optimize it away, because what the above pseudocode actually means is:
if (condition) <nothing!>;
statement;
2
solved “Unexpected token else” error [closed]