Loïc TRUCHOT
JavaScript Fullstack Expert & Senior web developer
Par Loïc TRUCHOT
var a = 5;
var b = false;
var c = 2 + 3;
var d = function() {
console.log('program scope:', a + c);
} // 1 2
if (a === c) { // 1 3
d(); // 4
} else {
a = b; // 1 2
}
var newProgram = {
a: 5,
b: false,
c: 2 + 8,
d: function() {
console.log('subprogram :', this.a + this.c);
}
}
newProgram.d();
By Loïc TRUCHOT