SOURCE

console 命令行工具 X clear

                    
>
console
// 原型链继承
// 缺点:多个实例对引用类型的操作会修改覆盖

// function SuperType () {
//     this.property = true
// }

// SuperType.prototype.getSuperValue = function () {
//     return this.property
// }

// subType.prototype = new SuperType()


// function subType () {
//     this.subProperty = false
// }

// subType.prototype.getSubTypeValue = function () {
//     return this.subProperty
// }

// console.log(new subType().getSuperValue())

// 构造函数继承


function SuperType() {
    this.color = ['red', 'green', 'yellow']
}

function SubType() {
    SuperType.call(this)
}

var instance = new SubType()
instance.color.push('black')

var instance1 = new SubType()

console.log(instance)
console.log(instance1)
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=, initial-scale=">
	<meta http-equiv="X-UA-Compatible" content="">
	<title>继承的实现方法</title>
</head>
<body>
	
</body>
</html>