Im11 - Precourse Review - Scope

node v0.12.18
version: 1.0.0
endpointsharetweet
Q1:
var x = 30; function get1() {return x; } var result = get1(20); 'result is: '+ result
Q2:
var x = 30; function get2 (x) { return x; } var result = get2(20); 'result is: '+ result
Q3:
var x = 30; function get3 () { return x; } function set3 (value) { var x = value; } set3(10); var result = get3(20); 'result is: '+ result
Q4:
var x = 30; function get4 () { return x; } function set4 (value) { x = value; } set4(10); var result = get4(20); 'result is: '+ result
Q5:
var x = 30; function get5 (x) { return x; } function set5 (value) { x = value; } set5(10); var result = get5(20); 'result is: '+ result
Q6:
var x = 10; function add6 (y) { return x + y; } function strangeAdd6 (x) { return add6(x) + add6(x); } var result = strangeAdd6(5); 'result is: '+ result
Q7:
var x = 10; function outer7 () { var x = 20; function inner7 () { return x; } return inner7(); } var result = outer7(); 'result is: '+ result
Q8:
var x = 10; function outer8 () { var x = 20; function inner8 () { x = x + 10; return x; } inner8(); } outer8(); var result = x; 'result is: '+ result
Q9:
var x = 10; function outer9 () { x = 20; function inner9 () { var x = x + 20; return x; } inner9(); } outer9(); var result = x; 'result is: '+ result
Q10:
var x = 10; function outer10 () { x = 20; function inner10 () { x = x + 20; } inner10(); } outer10(); var result = x; 'result is: '+ result
Loading…

no comments

    sign in to comment