array객체1 [2023-03-04]String객체,Array객체 Number(null) = 0 Number(undefined) = NaN 객체.valueOf() : 객체의 원시값을 반환해주는 메소드 //10이라는 값을 가진 num이라는 인스턴스를 생성성 let num = new Number(10); console.log(num); // [Number: 10] console.log(num.valueOf()); //10 하지만 모든 객체가 valueOf() 메소드가 있는 것은 아니다. Boolean,String,Number만 valueOf() 메소드가 있다. //객체를 만들기 위한 생성자 function Numbers(n){ return this.number = n; } valueOf라는 함수를 넣음 Number.prototype.valueOf = function(){ .. 2023. 3. 3. 이전 1 다음