<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<metaname="Generator" content="EditPlus">
<metaname="Author" content="">
<metaname="Keywords" content="">
<metaname="Description" content="">
</head>
<body>
<scripttype="text/javascript">
//string object
varmessage="Hello World!";
varx=message.length;
//console.log(x);
document.write(x);
document.write("<br />");
//string UpperCase
varupperCaseMessage=message.toUpperCase();
document.write(upperCaseMessage);
document.write("<br />");
//new Object()
varperson=newObject();
person.name="Lucker Xia";
person.sex="male";
person.age=25;
person.eyecolor="black";
document.write(person.name+" is "+person.age+" years old.");
document.write("<br />");
//Using an Object Constructor
functionanimal(category,age,color){
this.category=category;
this.age=age;
this.color=color;
}
varcat=newanimal("cat","1.5","yellow");
vardog=newanimal("dog","3","white");
document.write("The "+cat.color+" "+cat.category+" is "+cat.age+" years old.");
document.write("<br />");
document.write("The "+dog.color+" "+dog.category+" is "+dog.age+" years old.");
document.write("<br />");
vararticle=function(title,content,comment,url){
this.title=title;
this.content=content;
this.comment=comment;
this.changeTitle=changeTitle;
functionchangeTitle(newTitle){
this.title=newTitle;
}
}
varmyArticle=newarticle('Javascript Objects','Object is the main data type in JavaScript. "Everything" in JavaScript is an Object.In addition, JavaScript allows you to define your own objects.','This is simple!','http://www.w3schools.com/js/js_object_definition.asp');