Whats my codes problem? (JavaScript)

Hey so I was trying to make a test ‘script game’ thing. But It’s not working. Did I mess up completely on the code? Please help if you can. I have been messing with it but can’t figure out what I did wrong. Here is my code:

if confirm(“Are you ready to start?”) {
console.log(“k good”);
else {
console.log(“Shut up and click ok”)

prompt("Enter your name: ")
console.log('K. Your name is now ’ + name + ‘.’);
console.log(“And now random stuff”);
console.log(“Please ignore this”)

var userAnswer = prompt(“Type in yes”);

if(userAnswer = “yes”) {
console.log(“Yay you know how to type”);
else(userAnswer = “no”)
console.log(“learn how to type yes”)

var feedback = prompt(“say a number 1-7”)
if (userAnswer < 8)
console.log(“Good you know how to count”)
else (userAnswer > 8)
console.log(“Learn how to count”)

if confirm(“K its over, click OK now”) {
console.log(“K bye”);
else {
console.log(“Too bad its over”)

if requires brackets, you have:

if condition {


this should be:

if (condition){


you have this several times. (there are sites which give more debug info, makes it easier to spot such mistakes)
using a single equal sign:

if(userAnswer = "yes")

inside a if clause is a bad idea, try using a double equal sign for comparison.

else can’t have a condition, since it is everything else, you have:

else (userAnswer > 8) 

should be:


(like i said, else can’t have a condition)

1 Like

ohhhh! Thanks for the help!