목록this (2)
솔미는 성장중
colors.test() 배열 만드는 방법 1. 리터럴 방식으로 배열 만들기 const colors = ['Red', 'Green', 'Yellow', 'Blue'] 2. 생성자 함수 형식으로 배열 만들기 (new사용) const colors = new Array('Red', 'Green', 'Yellow', 'Blue') console.log(colors) //(4) ['Red', 'Green', 'Yellow', 'Blue'] //0: "Red" //1: "Green" //2: "Yellow" //3: "Blue" console.log(colors.includes('Green')) //true console.log(colors.length) //4 여기서 length, includes를 prototy..
메소드(객체 내 함수) this -> 객체 함수 this -> window object constructor function this -> 빈 객체를 가리킴 (여기다가 속성을 넣는거) 화살표 함수 this -> 상위 스코프 this 일반 함수의 this : 호출 위치에서 정의 : 아래 예제에서 this → PPAP로 바꿔주어도 결과가 동일 : 즉! this = getFullName이라는 속성이 들어있는 객체 데이터 const PPAP = { front: 'PenPineapple', end: 'ApplePen', getFullName: function() { return `${this.front} ${this.end}` } } console.log(PPAP.getFullName()) //PenPineapp..