Created
January 14, 2022 06:46
-
-
Save kryhtin/92a9ff49510b7db3938613b5558fbc74 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var a = {}; | |
(function b(a) { | |
a.a = 10; | |
a = null; | |
})(a); | |
console.log(a); | |
----------------------------- | |
for (var i = 0; i < 5; i++) { | |
setTimeout(function () { | |
console.log(i); | |
}, 1000); | |
} | |
------------------------------- | |
var func = []; | |
for (var i = 0; i < 6; i++) { | |
func[i] = function () { | |
console.log(i); | |
}; | |
} | |
func[3](); | |
--------------------------------------- | |
console.log(1); | |
setTimeout(() => { | |
console.log(2); | |
}, 1000); | |
setTimeout(() => { | |
console.log(3); | |
}, 0); | |
console.log(4); | |
(function () { | |
console.log(1); | |
setTimeout(() => {}, console.log(2), 1000); | |
setTimeout(() => {}, console.log(3), 0); | |
Promise.resolve(true).then(() => { | |
console.log(4); | |
}); | |
console.log(5); | |
})(); | |
----------------------------------------------------- | |
var a = 1; | |
function b() { | |
a = 10; | |
return; | |
function a() {} | |
} | |
b(); | |
console.log(a); | |
------------------------- | |
function test() { | |
console.log(a); | |
console.log(foo()); | |
var a = 1; | |
function foo() { | |
return 2; | |
} | |
} | |
test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment