JavaScript authoritative Guide (sixth Edition) first reading notes-objects

Source: Internet
Author: User

1 varBook = {2"Main title": "JavaScript",//There are spaces in the attribute name and must be represented by a string3"Sub-Title": "The Definitive Guide",//there are hyphens in the attribute name and must be represented by a string4' For ': ' All audiences ',//"for" is a reserved word, so you must use quotation marks5Author: {//Note that the attribute names here are not quoted6FirstName: "David",7Surname: "Flanagan"8     }9 }; -  //Object Get Property the  //Console.log (book.author); -  - //Add Property - //book.date = "2017.7.27"; + //Console.log (book.date); -  + //Delete Property A Deletebook.date; at  - //Object Traversal -  for(varIteminchBook ) { -Console.log (typeof(Book[item])); -     Switch(typeof(Book[item])) { -          Case' Object ': in              - Console.log (Book[item]); to              Break; +         default: -Console.log (item + "= =" +Book[item]); the              Break; *  $     }Panax Notoginseng  - } the  + //Object Replication A  the //copies the member property of O to P and returns the P +  - functioncopy (o) { $   varp = O | | {};//if no object is passed to the parameter p, a newly created object is used $   returnp; - } -  the varBook1 =copy (book); - //Console.log (BOOK1);

JavaScript authoritative Guide (sixth Edition) first reading notes-objects

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.