Seven things you need to know about beginners JavaScript

Source: Internet
Author: User

1.1. Thumbnail mark

//Defining Objects//var car = new Object (); //car.colour = ' red '; //car.wheels = 4; //car.hubcaps = ' spinning '; //car.age = 4; //the simple wording of the above code:            varCar ={colour:'Red', Wheels:4, Hubcaps:'Spinning', Age:4            }//Defining Arrays            varTestarr =NewArray ('str1','str2','STR3','STR4'); //the simple wording of the above code:            varTestarr = ['str1','str2','STR3','STR4']; //Associative Arrays            varCar =NewArray (); car['Colour'] ='Red'; car['Wheels'] =4; car['hubcaps'] ='Spinning'; car[' Age'] =4;
Triple Marker method
var direction;
if (x<200) {direction=1;} Else{direction=-1}
The triple notation can be written as
var direction=x<200?1:-1;

1.2. JSON data format

JSON is the abbreviation for JavaScript Object notion

       Description band        var band = {                "name": "The Red hot Chili Peppers",                "members": [                    {                        "name": "Zhangsan",                        " Role ":" Lead vocals "                    }, {                        " name ":" Lisi ",                        " role ":" Bass guitar,trumpet,backing vocals "                    }                ], "Year                ": "The"            }

Json-p cross-domain application: http://www.cnblogs.com/chopper/archive/2012/03/24/2403945.html

Seven things you need to know about beginners JavaScript

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.