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 foo(a) { | |
var b = a*2; | |
function bar(c) { | |
console.log(a, b, c); | |
} | |
bar(b * 3); | |
} | |
foo(2); //2, 4, 12 |
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 bar() { | |
var a = 10; | |
console.log(a, b, c); | |
} |
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 bar() { | |
a = 10; | |
console.log(a, b, c); | |
} |
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 boo() { | |
a = 10; | |
} | |
boo(); | |
console.log(a);//10 |
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 foo(a) { | |
var b = a*2; | |
function bar(c) { | |
console.log(a, b, c); | |
} | |
bar(b * 3); | |
} | |
foo(2); //2, 4, 12 |
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 foo(a) { | |
var b = a*2; | |
function bar(c) { | |
console.log(a, b, c); | |
} | |
bar(b * 3); | |
} | |
foo(2); //2, 4, 12 |
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 foo() { | |
var c = 10; | |
function bar() { | |
var c = 5; | |
console.log(c);//5 | |
} | |
bar(); | |
} | |
foo(); |
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 foo() { | |
a = 2; | |
} | |
foo(); | |
console.log(a);//2 |
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
//this code creates and adds properties to an object | |
var obj = { | |
a:1, | |
b:2, | |
c:3 | |
}; |
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
//this code changes the property values of object "obj" | |
//i.e the value of "a" was initially 1 | |
obj.a = 2; | |
obj.b = 3; | |
obj.c = 4; |