JSON in Javascript

Source: Internet
Author: User
Tags hasproperty
(1) JSON is the native support in JavaScript (compared with XML );

(2) The disadvantage is that on the server side, the Secondary package of the server language is less mature than the XML format data. (3) In fact, JSON is eventually an array, objects can exist in the array; objects can contain arrays; (4) declared objects in JS; Public attribute declarations are directly declared on objects; var book = function (name) {This. name = Name;} book. prototype. setname = function (nname) {This. name = nname;} book. prototype. getname = function () {return this. name ;}while defining public methods can be defined on the prototype object; this saves memory space; (5) defining public attributes on the prototype property; if the object or array is defined. All objects will have this property. This is also the reason that the public property is not defined on the prototype object; (6) defining local variables; (7) hasownproperty: This method can only determine the attributes directly defined on the object, and false is returned for the inherited attributes; (8) hasproperty method can determine the inherited methods; (9) object. protoype. hasproperty = function (proname) {return (this & this [proname])! = Undefined; }
Related Article

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.