Front-End/
Functions
taehyun_kim
2018. 4. 12. 20:42
함수 선언
- 파라미터로 non-primitive value가 넘어오면 원본도 바뀐다.
function myFunc(theObject) {
theObject.make = 'Toyota';
}
var mycar = {make: 'Honda', model: 'Accord', year: 1998};
var x, y;
x = mycar.make; // x gets the value "Honda"
myFunc(mycar);
y = mycar.make; // y gets the value "Toyota"
// (the make property was changed by the function)
bind, apply, call 이란?
Function level scope
var로 선언된 변수나, 함수 선언