Skip to content

Instantly share code, notes, and snippets.

@StrykerKent
Last active December 14, 2018 16:16
Show Gist options
  • Save StrykerKent/1b29dc8cb32abdcd57c293a2865d1123 to your computer and use it in GitHub Desktop.
Save StrykerKent/1b29dc8cb32abdcd57c293a2865d1123 to your computer and use it in GitHub Desktop.
Example of an arrow function with a conditional ternary if statement in JavaScript.
var arrowFunction = x => x % 2 == 0 ? "even" : "odd";
for(var i = 0; i < 100; i++) {
console.log([i] + " " + arrowFunction([i]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment