Skip to content

Instantly share code, notes, and snippets.

@bashbaugh
Last active February 27, 2019 01:54
Show Gist options
  • Select an option

  • Save bashbaugh/93b3d8a95ff86d1235fe7a4a1e01391b to your computer and use it in GitHub Desktop.

Select an option

Save bashbaugh/93b3d8a95ff86d1235fe7a4a1e01391b to your computer and use it in GitHub Desktop.
if (happy) // if happy is true (remember, 1 is considered true in javascript and 0 is considered false)
{ // <-- then start here
console.log("You are happy");
} // <-- and stop here
else // else, if happy is NOT true
{ //then start here
console.log("You are NOT happy");
} // and stop here
if (happy && sad) // if happy and (&&) sad is true (will only be true if both are true)
{
console.log("Imposible! You are happy AND sad!");
}
if (!sad || !happy) // if not (!) sad, OR (||) not happy (will be true if one (or both) are true)
{
console.log("You are either not sad, OR you are not happy (or you are neither happy nor sad).");
}
if (name != "Bob") // if name is not (!=) Bob
{
console.log("You are not named Bob!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment