Last active
January 5, 2016 06:19
-
-
Save dmsnell/a62695a630f7fede347c to your computer and use it in GitHub Desktop.
What will the following script spit out?
This file contains 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
const l = m => console.log( m ); | |
console.clear(); | |
const a = () => { l( 'a ran' ); return 'a'; }; | |
const b = () => { l( 'b ran' ); return 'b'; }; | |
const c = false | |
? a() | |
: b(); | |
l( 'Ternary test: ' + c ); | |
const d = [ a(), b() ].slice(0, 1).join( ', ' ); | |
l( 'List test: ' + d ); | |
const e = ((...args) => args.slice( 1 ).join( ', ' ))( a(), b() ); | |
l( 'Arg test: ' + e ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment