person={
firstname:"Mark",
lastname:"Yun",
age:25,
eyecolor:"black"
};
function Person(){}
var person=new Person(); //定义一个function,如果使用new"实例化",该function可以看作是一个Class
="Mark";
person.age="25";
person.work=function(){
alert(+" hello...");
}
person.work();
function Pet(name,age,hobby){
=name; //this作用域:当前对象
this.age=age;
this.hobby=hobby;
this.eat=function(){
alert("我叫"++",我喜欢"+this.hobby+",是个程序员");
}
}
var maidou =new Pet("麦兜",25,"coding"); //实例化、创建对象
maidou.eat();//调用eat方法
var wcDog =new Object();
="旺财";
wcDog.age=3;
wcDog.work=function(){
alert("我是"++",汪汪汪......");
}
wcDog.work();
function Dog(){}
="旺财";
Dog.prototype.eat=function(){
alert(+"是个吃货");
}
var wangcai =new Dog();
wangcai.eat();
function Car(name,price){
=name;
this.price=price;
}
Car.prototype.sell=function(){
alert("我是"++",我现在卖"+this.price+"万元");
}
var camry =new Car("凯美瑞",27);
camry.sell();
.
















