Last active
August 29, 2015 14:02
-
-
Save yoshuawuyts/74bce39c5dd8970fde53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Functions | |
*/ | |
var x = function(arg1, arg2) { | |
return arg1 * arg2; | |
}; | |
var x = (arg1, arg2) => arg1 * arg2; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* If / else | |
*/ | |
function multiliner() { | |
if ('orange' == 'pineapple') { | |
return 'wow'; | |
} if else ('orange' == 'banana') { | |
return 'baww'; | |
} else { | |
return 'naww'; | |
} | |
} | |
function oneliner() { | |
if ('orange' == 'pineapple') return 'wow'; | |
if ('orange' == 'banana') return 'bawww'; | |
return 'naww'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Value assignment | |
*/ | |
if (var x == 'potato') { | |
var y = 'french fries' | |
} else if (var x == 'dog') { | |
var y == 'wok n walk'; | |
} else { | |
var y == 'buffalo bill'; | |
} | |
var y = 'buffalo' == x ? 'french fries' | |
: 'dog' == x ? 'wok n walk' | |
: 'buffalo bill' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment