ga-wdi-exercises / project1

[project] GA- Project 1
3 stars 75 forks source link

Quick question on for/if #171

Closed dan-ator closed 9 years ago

dan-ator commented 9 years ago

In an if/else statement, how do I tell it to just do nothing in the else part? In other words,

function nextButton() {
    if (currentNumber < (cardData.length-1)) {
      currentNumber++;
      drawCard();
    } else {
      alert("You're Done!")
    }
  }

instead of using the alert to say youre done, I want it just not to do anything.

RobertAKARobin commented 9 years ago

Three backtics for multiple lines of code!

Just omit the else bit:

function nextButton() {
    if (currentNumber < (cardData.length-1)) {
      currentNumber++;
      drawCard();
    }
  }