/*
* (Refer to <JavaScript core> p151)
* @ Time 2008-11-25
*/
CopyCodeThe Code is as follows: // No Return Value
Function test0 (){
This. Name = 'test0 ';
}
VaR test0 = new test0;
// Debugger;
Alert (test0); // output [object]
Alert (test0.name); // output test0
// Return a String object
Function Test (){
This. Name = 'test ';
Return new string ('20140901'); // returns a String object.
}
VaR test = new test ();
Alert (TEST); // output 123
Alert (test. Name); // output undefined, indicating that the object created by a constructor is a string object.
// Return a string of the original type
Function Test2 (){
This. Name = 'test2 ';
Return '20140901'; // returns a String object.
}
VaR Test2 = new Test2 ();
Alert (Test2); // output [object]
Alert (test2.name); // output test0
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service