Skip to content

Instantly share code, notes, and snippets.

@syul
Last active January 12, 2017 09:22
Show Gist options
  • Save syul/ab6097e53c511c1e225a3b89d10f41fe to your computer and use it in GitHub Desktop.
Save syul/ab6097e53c511c1e225a3b89d10f41fe to your computer and use it in GitHub Desktop.
test
---------------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