Last active
January 12, 2017 09:22
-
-
Save syul/ab6097e53c511c1e225a3b89d10f41fe to your computer and use it in GitHub Desktop.
test
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
---------------1-------------- | |
var a = (function(a) { | |
return function(b) { | |
return a + b; | |
} | |
})(5)(5); | |
console.log(a); | |
---------------2-------------- | |
var a = 5; | |
function foo(bar) { | |
bar = 4 | |
}; | |
foo(a); | |
console.log(a); | |
---------------3-------------- | |
var foo = 1; | |
function bar() { | |
if (!foo) { | |
var foo = 10; | |
} | |
alert(foo); | |
} | |
bar(); | |
---------------4-------------- | |
var a = 1; | |
function b() { | |
a = 10; | |
return; | |
function a() {} | |
} | |
b(); | |
---------------5-------------- | |
for (var i = 0; i < 10; i++) { | |
setTimeout(function () { | |
console.log(i); | |
}, 0); | |
} | |
alert(a); | |
---------------6-------------- | |
function foo2() | |
{ | |
return | |
{ | |
bar: "hello" | |
}; | |
} | |
console.log(foo2().bar) | |
---------------7-------------- | |
var list = readHugeList(); | |
var nextListItem = function() { | |
var item = list.pop(); | |
if (item) { | |
// process the list item... | |
nextListItem(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment