201507020721_ JavaScript authoritative Guide (sixth edition)--oo: Collection class and enumeration class, standard conversion method (p217-225)

Source: Internet
Author: User

I. Object-oriented technology in JavaScript (solving how to use the fatigue in JS programming)

1. Examples of collection classes

The collection represents a non-repeating unordered collection. Two basic methods: A. Add to Collection B. Whether in the collection.

    Reference: p218 set.js

2. Enumeration examples

Enumeration represents a limited set of values.

    Examples of Poker

Two. Standard conversion method

1. toString (); Tolocalstring ();

2. ValueOf ();

3. ToJSON (); When an object is serialized, it ignores the prototype and constructor of the object.

Note: json.stringify (); Converts an object to a string format;

Json.  Parse (); The object is changed to a pure object, there is no method;

4.

Three. Comparison method

1. Constructor = = constructor? elements = = elements?

p225

201507020721_ JavaScript authoritative Guide (sixth edition)--oo: Collection class and enumeration class, standard conversion method (p217-225)

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.