Last active
May 17, 2016 06:47
-
-
Save Lucifier129/3dcc99e0ea2f8b0c90f636ce60ccc513 to your computer and use it in GitHub Desktop.
JS Pop Quiz: How well do you know your functions?
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
// the array of functions | |
const fns = [ | |
function () { | |
console.log(1) | |
}, | |
function () { | |
console.log(2) | |
}, | |
function () { | |
console.log(3) | |
} | |
] | |
// it's equal to (...args) => Function.prototype.call.call(Function.prototype.call, ...args) | |
const call = Function.prototype.call.bind(Function.prototype.call) | |
fns.forEach(call) // change this line if you like | |
// Expected console output should be | |
// 1 | |
// 2 | |
// 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
joputa :)