<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
function A() {
this.name = '时分秒';
this.age = 22;
this.info = ['55kg', '180cm'];
this.skill = function () {
console.log('我能吃');
}
}
var a = new A();
var a1 = new A();
var a2 = new A();
function B() {
B.prototype.name = '犬夜叉';
B.prototype.age = 25;
B.prototype.info = ['66kg', '185cm'];
B.prototype.skill = function () {
console.log('我能打');
}
}
var b = new B();
var b1 = new B();
var b2 = new B();
b.info.push('strong');
console.log(b1.info);
function C(){
this.name = '奈落';
this.age = '200';
this.info = ['190cm', '60kg']
}
C.prototype.skill = function () {
console.log('我会骗');
}
var c = new C();
C.prototype.skill();
function D() {
this.name = '桔梗';
this.age = 22;
this.info = ['178cm', '50kg']
if(!D.prototype.skill){
D.prototype.skill = function () {
console.log('我爱阿狸');
}
}
}
var d = new D();
d.skill();
</script>
</body>
</html>