大家好,今天来分享一下JavaScript 面向对象class继承
这是我们之前关于JavaScript原型继承的示例代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
var student= {
name:"shuaige",
age:3,
run: function () {
console.log(this.name + " run......");
}
};
var bird = {
fly:function () {
console.log(this.name + "fly.......");
}
};
var xiaoming = {
name:"xiaoming",
};
xiaoming.__proto__=bird; //把原型指向bird,xiaoming就可以飞了
</script>
</head>
<body