天天看点

Js 创建对象

<html>

<body>
	<script>
		var person = new Object();
		person.name = "Nicholas";
		person.age = 29;
		person.job = "Software Engineer";
		
		person.sayName = function()
		{
			return this.name;
		};
		
		person.sayName();
		
		document.write(person.sayName());
	</script>
</body>
</html>