Last active
July 1, 2016 14:21
-
-
Save BenBestmann/5982118331fd87767986fb44970a68a5 to your computer and use it in GitHub Desktop.
Simulate named parameters in ES5 using an object literal, passing multiple parameters as a single actual parameter.
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
function selectEntries(options) { | |
options = options || {}; | |
var start = options.start || 0; | |
var end = options.end || -1; | |
var step = options.step || 1; | |
// function implementation | |
} | |
selectEntries({ start: 3, end: 20, step: 2 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment