26장 ES6 함수의 추가 기능
26.1 함수의 구분
함수
constructor
prototype
super
arguments
26.2 메서드
const obj = {
x: 1,
// 메서드
foo(){return this.x}
// 일반 함수
bar: function(){return this.x}
}
console.log(obj.foo()) // 1
console.log(obj.bar()) // 1
// ES6에서 메서드는 인스턴스를 생성할 수 없는 non-constructor이기에 생성자 함수로서 호출할 수 없다.
new obj.foo() // TypeError
new obj.bar() // bar{}26.3 화살표 함수
26.3.1 화살표 함수 정의
26.3.2 화살표 함수와 일반 함수의 차이
26.3.3 this
26.3.4 super
26.3.5 arguments
26.4 Rest 파라미터
26.4.1 기본 문법
26.4.2 Rest 파라미터와 arguments 객체
26.5 매개변수 기본값
Last updated