es6之前(es5)是 不用类 创建对象的 通过构造函数
类的创建有三种方式:
1.字面量创建
2.new Object
3.构造函数













不是很明白我们看看下面的代码:








<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
function Person(uname ,age) {
this.uname = uname;
this.age = age;
// this.sing = function(){
// console.log('我会做饭');
// }
}
// Object.prototype.sex = '他就是一个不会事件管理的男神,如今都无人问津!!!'//3
// Person.prototype.sex = '他是一个情窦初开的男生,而且长得很man' //2
var lumingqing = new Person('小酷','22');
// lumingqing.sex = '他是一个拾金不昧的孩子,而且长得很帅' //1.先去自身查找
console.log(lumingqing.sex);//4.undefined
</script>
</html>
一层一层往上爬
扩展内置对象





