0

javascript file:

var danger = 1;
var safe = 2;

function stepLeft() {
    if (danger == 1) {
        alert("STOP!")
    } else {
        alert("START!")
    }
}

Nothing is happening when I try this. No error message in console either. (the script is linked properly in html).

1
  • Just call the Js function, stepLeft(); Commented Sep 18, 2014 at 15:48

1 Answer 1

1

You only defined the function, but you actually never ran it. Try adding

stepLeft();

After the definition to execute it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.