SOURCE

function Dog(name,age,dogFriends){
	//属性
	this.name = name;
	this.age = age;
	this.dogFriends = dogFriends;
	
	//方法
	this.eat = function(something){
		console.log(this.name + '在吃' + something);
	};
	this.run = function(somewhere){
		console.log(this.name + '跑' + somewhere);
	};
	
	
}
	//小狗
	var smallDog = new Dog('小小',1);
	smallDog.age = 10;
	console.log(smallDog.name,smallDog.age);

	smallDog.eat('奶');
	smallDog.run('公园');
	
	//大狗
	var bigDog = new Dog('大大',10,['白白','胖胖']);
	console.log(bigDog.name);
	bigDog.eat('apple');
	bigDog.run('广场');












console 命令行工具 X clear

                    
>
console