변수

스우언·2021년 7월 24일
0

Variable
non-Object : Primitive
Undefined, Null, Boolean, Number, String
Object : Collection of Property(key-value pair)
.Reference
.Constructor
Array
Function
Function Expressions(함수 표현식)
Function Declarations(함수 선언식)
.Hoisting
Method : Object의 Property로 사용되는 Function
Object 내에서 Method가 호출될 때 this 사용
(런타임 시 Object에 바인딩)
Enumeration
Array
for (var i = 0; i < arr.length; i += 1) {}
arr.forEach(function (var /, i, arr/) {});
arr.map(function (var /, i, arr/) {});
Object
Object.keys(obj);
Object.keys(obj).map(function (key) {});
Prototype
자바스크립트의 모든 객체는 자신의 부모 역할을 하는 객체와 연결되어 있다. 이러한 부모 객체를 'prototype'이라고 한다.
모든 자바스크립트 객체는 내부적으로 prototype 속성을 가진다.
크롬 브라우저에서는 proto 형태로 구현되어 있다.
prototype 속성의 값은 null 이거나 object 이다.
object는 prototype 속성으로 상속 받는다.
own property는 객체가 직접 가진 속성
arr.hasOwnProperty();
inherited property는 부모 prototype으로부터 물려받은 속성
array.prototype.hasOwnProperty();

0개의 댓글