Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- Server
- LIST
- Pattern
- mariaDB
- 자바
- error
- 인공지능
- ai
- 함수
- Deep
- Spring
- Web
- mysql
- git
- SSH
- Github
- Linux
- java
- Numpy
- interface
- framework
- db
- Analysis
- data
- Security
- learning
- javascript
- DeepLearning
- Python
- centos
Archives
- Today
- Total
PostIT
[Javascript/Object] 자바스크립트에서의 상속 - Object.create()에 설명 본문
Script/JavaScript
[Javascript/Object] 자바스크립트에서의 상속 - Object.create()에 설명
shun10114 2017. 2. 14. 13:03Object.create();
Object.create = function(o){
function F(){}
F.prototype = o;
return new F();
}
- 익스플로러 9버전 이후부터 지원
- new 키워드를 사용할 떄와는 달리 전체적으로 소스의 생성자의 개념이 약해지고, 객체의 인스턴스 간의 상속을 강조하는 것.
var person = {
yell : function (){
alert(“My Name is “ + this.name);
}
};
var example = Object.create(person);
example.name=“Hooney”;
example.yell(); // ===“My Name is Hooney”
console.log(example instances person); // ===TypeError
console.log(example.getPrototypeOf(person)===person); // === true
console.log(Object.prototype.isPrototypeOf(example)); // === true
'Script > JavaScript' 카테고리의 다른 글
[Javascript/Request] Get URI, Protocol, Host in Javacsript(자바스크립트) (0) | 2017.03.08 |
---|---|
[Javascript/Ajax] JavaScript에서의 변수 담아내기 - async(동기 Ajax) (0) | 2017.03.06 |
[Javascript] event.keyCode 코드값 - 퍼옴 (0) | 2017.02.09 |
[JavaScript/jQuery] Array안에 있는 값을 찾아 지워주는 것 (0) | 2017.02.02 |
[JavaScript/jQuery] jQuery에서 Append & Remove 처리하기. (0) | 2017.02.02 |
Comments