mardi 26 mars 2019

If statement - Jquery

Following codes, I don't understand why do we have to write if (!started) <--

var started = false;

//2. Create a new variable called level and start at level 0. var level = 0;

//1. Use jQuery to detect when a keyboard key has been pressed, when that happens for the first time, call nextSequence(). $(document).keypress(function() { if (!started) {

//3. The h1 title starts out saying "Press A Key to Start", when the game has started, change this to say "Level 0".
$("#level-title").text("Level " + level);
nextSequence();
started = true;

} });

I just started teaching myself coding.

Aucun commentaire:

Enregistrer un commentaire