Skip to content

Instantly share code, notes, and snippets.

@yashikagarg13
Created May 17, 2016 12:34
Show Gist options
  • Save yashikagarg13/8e25bcefc4f2087b2b3e21c379ae401c to your computer and use it in GitHub Desktop.
Save yashikagarg13/8e25bcefc4f2087b2b3e21c379ae401c to your computer and use it in GitHub Desktop.
const fns = [
function () {
console.log(1)
},
function () {
console.log(2)
},
function () {
console.log(3)
}
]
const call = Function.apply(this, ['fn', 'return fn()']);
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