Last active
December 27, 2018 22:11
-
-
Save carlinmack/5a0353f610524a8704105a2e9cf1c3af to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/xejuloh
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
function baz() { | |
let val; | |
return function bar() { | |
if (val === undefined) { | |
console.log('working'); | |
val = ['values', 'values'] | |
return val; | |
} else { | |
return val; | |
} | |
} | |
} | |
let foo = baz(); | |
for (var i = 0; i < 10; i++) { | |
console.log(foo()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment