function Timer() {
this.timerId = setInterval(function() {
console.log('This is timer log.');
}, 1000);
}
!
!
!
var timer = new Timer();
timer = null;
Slide 65
Slide 65 text
function Timer() {
this.timerId = setInterval(function() {
console.log('This is timer log.');
}, 1000);
}
!
!
!
var timer = new Timer();
timer = null;
ݺͼग़͠ݩΛഁغͯ͠
λΠϚʔ͕࣮ߦ͞Εଓ͚Δ
Slide 66
Slide 66 text
function Timer() {
this.timerId = setInterval(function() {
console.log('This is timer log.');
}, 1000);
this.stop = function() {
clearInterval(this.timerId);
};
}
!
!
!
var timer = new Timer();
timer.stop();
timer = null;
Slide 67
Slide 67 text
function Timer() {
this.timerId = setInterval(function() {
console.log('This is timer log.');
}, 1000);
this.stop = function() {
clearInterval(this.timerId);
};
}
!
!
!
var timer = new Timer();
timer.stop();
timer = null;
λΠϚʔ
ͪΌΜͱࢭΊΔ͜ͱʂ
Slide 68
Slide 68 text
Ϋϩʔδϟ
λΠϚʔ
ίϯιʔϧ
॥ࢀর
Slide 69
Slide 69 text
function Closure() {
var value = 1000;
return function() {
return value;
};
}
Slide 70
Slide 70 text
function Closure() {
var value = 1000;
return function() {
return value;
};
}
value͔ؔΒ
ࢀর͞Εଓ͚ͯ͠·͏
Slide 71
Slide 71 text
function Closure() {
var value = 1000;
return function() {
var another = 2000;
return another;
};
}
Slide 72
Slide 72 text
function Closure() {
var value = 1000;
return function() {
var another = 2000;
return another;
};
}
valueࢀর͞Εͳ͘ͳΔ
ͷͰGCʹճऩ͞ΕΔ
Slide 73
Slide 73 text
॥ࢀর ίϯιʔϧ
λΠϚʔ Ϋϩʔδϟ
Slide 74
Slide 74 text
var family = [];
!
var child = {
age: 10
container: family
};
!
var parent = {
child: child,
container: family
};
!
family.push(child);
family.push(parent);
Slide 75
Slide 75 text
var grandparent = {
child: parent,
container: family
};
!
family.push(parent);
Slide 76
Slide 76 text
var grandparent = {
child: parent,
container: family
};
!
family.push(parent);
ઇͩΔ·ࣜʹ૿͑ΔϝϞϦ