스크립트가 실행되면서 생성되는것으로
생성된 순서대로 Stack 메모리에 삽입되며
언제나 1개의 Variable Environment,
1개의 Lexical Environment,
그리고 1개의 This Binding 속성으로 구성되어 있는 것
26.
Execution Context
스크립트가 실행되면서생성되는 것으로
생성된 순서대로 Stack 메모리에 삽입되며
언제나 1개의 Variable Environment,
1개의 Lexical Environment,
그리고 1개의 This Binding 속성으로 구성되어 있는 것
var korName =“Inkwon”
전역 실행 컨텍스트
전역 변수 객체
scope ( 스코프 체인 )
korName : undefined -> Inkwon
this
29.
함수 호출 시실행 컨텍스트
var korName = “Inkwon”
function test() {
var korName = “Lee”
}
test();
30.
var korName =“Inkwon”
function test() {
var korName = “Lee”
}
test();
전역 실행 컨텍스트
전역 변수 객체
scope ( 스코프 체인 )
korName
test
this
31.
test 함수 실행시 test 실행 컨텍스트 생성
전역 실행 컨텍스트
전역 변수 객체
scope ( 스코프 체인 )
korName
test
this
var korName = “Inkwon”
function test() {
var korName = “Lee”
}
test();
32.
전역 실행 컨텍스트
varkorName = “Inkwon”
function test() {
var korName = “Lee”
}
test();
test 실행 컨텍스트
test 변수 객체
scope ( 스코프 체인 )
korName
this
33.
전역 실행 컨텍스트
test2실행 컨텍스트
test2 변수 객체
scope ( 스코프 체인 )
this
test 실행 컨텍스트
var korName = “Inkwon”
function test() {
var korName = “Lee”
function test2() {
return korName
}
test2();
}
test();
34.
전역 변수 객체
test2변수 객체
var korName = “Inkwon”
function test() {
function test2() {
return korName
}
return test2();
}
console.log(test());
test 변수 객체
호이스팅
35.
var korName ="inkwon";
function test1() {
return korName;
}
function test2() {
var korName = "Lee";
return test1();
}
console.log(test2());
36.
전역 실행 컨텍스트
전역변수 객체
scope ( 스코프 체인 )
korName
test1
test2
var korName = "inkwon";
function test1() {
return korName;
}
function test2() {
var korName = "Lee";
return test1();
}
console.log(test2());
this
37.
var korName ="inkwon";
function test1() {
return korName;
}
function test2() {
var korName = "Lee";
return test1();
}
console.log(test2());
전역 실행 컨텍스트
test2 실행 컨텍스트
test2 변수 객체
scope ( 스코프 체인 )
korName
this
38.
var korName ="inkwon";
function test1() {
return korName;
}
function test2() {
var korName = "Lee";
return test1();
}
console.log(test2());
전역 실행 컨텍스트
test1 실행 컨텍스트
test1 변수 객체
scope ( 스코프 체인 )
this
test2 실행 컨텍스트
39.
var korName ="inkwon";
function test1() {
return korName;
}
function test2() {
var korName = "Lee";
return test1();
}
console.log(test2());
전역 변수 객체
test1 변수 객체
test2 변수 객체
40.
전역 변수 객체
test1변수 객체
전역 변수 객체
test2 변수 객체
var korName = "inkwon";
function test1() {
return korName;
}
function test2() {
var korName = "Lee";
return test1();
}
console.log(test2());
41.
JavaScript에서 prototype은 함수의속성이며 생성자 함수에서 만든
개체의 속성입니다. 함수의 프로토타입은 개체입니다.
이는 함수가 생성자로 사용될 때 주로 사용됩니다.
Prototype
Person.prototype.getName = function(){…}
Person.prototype.setName = function(reName) {…}
var korName = new Person(“inkweon”);
var usName = new Person(“Christy”);
function Person(name) {
this.name = name;
}