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 = [1, 2, 3, 4] | |
for (var ai = 0; ai < a.length; ai++) { | |
setTimeout(function(){ | |
// By the time this code will be executed, all the iterations of | |
// for loop would have completed and value of ai would be 4 | |
console.log("Value of 'ai': " + ai) | |
}, 1000) | |
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 log = console.log | |
log("Inside global execution context") | |
function functionOne() { | |
log("Inside function one") | |
function setTimeoutFunction() { | |
log("Inside setTimeoutFunction: I will be executed after ECS become empty." + | |
"Though my waiting time is zero") |
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 log = console.log | |
log("Inside global execution context") | |
function functionOne() { | |
log("Inside function one") | |
function setTimeoutFunction() { | |
log("Inside setTimeoutFunction: I will be executed atleast after 1 sec") | |
} |
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
console.log("Inside global execution context") | |
// 'a' will be stored on ECS as it's a primitive value | |
var a = 10; | |
// Only reference of functionOne will be stored inside stack. | |
// funtionOne definition itseld will be stored on heap | |
function functionOne() { | |
console.log("Inside functionOne exectuon context") | |
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
import inspect | |
def decorator_wrapper(parameter): | |
print parameter | |
def decorator(func): | |
def wrapper(message): | |
print "Wrapper start" | |
func(message) | |
print "Wrapper end" |
NewerOlder