Skip to content

Instantly share code, notes, and snippets.

@ashryanbeats
Created February 14, 2012 01:32
Show Gist options
  • Save ashryanbeats/1822336 to your computer and use it in GitHub Desktop.
Save ashryanbeats/1822336 to your computer and use it in GitHub Desktop.
Conditionals in Javascript 2.6
var yourName = "Ash";
var gender = "Blue";
var result;
if (yourName.length > 0 && gender.length > 0) {
if (gender === "Male" || gender === "Female") {
result = "Thanks";
} else {
result = "Please enter male or female for gender.";
}
} else {
result = "Please tell us both your name and gender.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment