Created
September 1, 2015 09:46
-
-
Save softwarespot/44ec4e06cb86da69e58e to your computer and use it in GitHub Desktop.
A simple demo of some of the new features of ES2015
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
// Example of using ES2015 | |
// IIFE | |
(() => { | |
// Example of using rest params | |
function main(...args) { | |
// Cache length to increase performance | |
for (let i = 0, length = args.length; i < length; i++) { | |
// Display in the browser console | |
console.log(args[i]); | |
} | |
} | |
// Call main with a random number of arguments | |
main('a', 'b', 'c'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment