JavaScript初心者教程Object 1
chapter 1 name:object defination/an object can be a or some varieties
<html>
<body>
<p> create a JavaScript object p>
<p id="demo"> p>
<script>
var person={firstName:"Liu",lastName:"Nick"};
document.getElementById("demo").innerHTML =person.firstName+person.lastName+"is very smart ";
script>
body>
html>
chapter 2 name:the message to create and use a object<html>
<body>
<p> create and use a object p>
<p id="demo"> p>
<script>
var person ={
firstName:"John",
lastName:"Deo",
id:5566,
fullNmae:function() {
return this.firstName + "" + this.lastName; //this can be changed into person
}
};
document.getElementById("demo").innerHTML=person.fullName();
script>
body>
html>