JavaScript: Understanding Object

Source: Internet
Author: User
Tags object object

What is the original value of Object,object for the object type? The need to use constructor prototype,constructor means that the function has a default property prototype, and this prototype.valueof constructor defaults to the original value of the function. Object.constructor.valueof () can output the original value of the object and output it as function function () {[native code]}. But now the browser can directly output the original value of alert (Object).

Now let's take a look at the object usage, the var o = new Object () instance O needs a new object object, and also this O has the prototype property of the object, as well as the use of a function function, as well as the o[parameter], From the above object primitive value can be seen.

O.prototype; O[value]; O=function () {}o={}

So we direct alert (object ()), the output is [Object Object], then what does this divine horse mean? Why not an object? Because the second object is a class , in the JavaScript world, object class is actually an object, so you should be able to understand object. Then the valueof the object method has 5 types, respectively: ' Object ', ' string ', ' Undefined ', ' boolean ', ' number '. If this value is not (null,undefined), it is the object that is output above. If the object method has one of the 5 types in the above, the parameter valueinside the method is output.

JavaScript: Understanding Object

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.