본문 바로가기

Front-End/

Functions

함수 선언



 - 파라미터로 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로 선언된 변수나, 함수 선언

'Front-End > ' 카테고리의 다른 글

Clean Code Javascript  (0) 2019.02.13
ES6 문법 개요  (0) 2018.12.26
Web Worker(웹 워커) - 멀티 스레드 쓰고 싶어!  (0) 2018.02.21
Prototype, Object 이해하기  (0) 2017.11.04
Closure  (0) 2017.06.20