JS Basic Knowledge Introduction

Source: Internet
Author: User

//JS Case sensitive note ' and;        //single-line comment        /*Multi-line comments*/            //JS Output Syntax    //alert (' Sunday ');    //console.log (' Sunday ') Console output    //var aa = prompt (' Please enter your name '); the input is a string and the operation is to be converted into a numeric value. text Box    //document.write (' 123 '); Web input        //Digital Type: number    //var AA = assigned value    varnumb = 123; varStr= "123"; //alert (' typeof number ');        //conversion of numeric types       //Turn Digital Type              //Number (str);       //Alert (typeof number (str));       //parseint (); Integer Turn       //parsefloat (); There are decimals              //Turn characters       //String ();       //toString ();       //alert (typeof numb.tostring ());       //Example:       varA = 12; varb = "10"; //alert (a+b);       //alert (A+number (b));       //alert (A+parseint (b));              //operator       //+ - * / %              //addition       //1 Normal addition       varc = 1; varD = 2; varE = c +D; //alert (e);       //2 concatenation of strings       varf = "Hello"; varg = "World"; varh = f +G; //alert (h);       //3 value to string       vari = 1; varj = "2"; varK = i +J; //alert (typeof K);              //Subtraction       //subtraction of 1 values       varL = d-C; //alert (L)       //2 Take negative numbers       //3 String to value       varm = J-i; //alert (typeof m);              //multiplication         //multiplication of numerical values              //Division         //Division of numeric values       //Take surplus       //var n = +;       //var o = 3;       //var p = n% o;       //alert (p);              //compound operator: + = = *=/=%=       //var q = n;           //q +=5;           //equivalent to q = q + 5;       //alert (q);           //q-=5;             //equivalent to q=q-5;           //alert (q);           //q*=3;           //equivalent to q=q*3;           //alert (q);           //q/= 2;           //equivalent to Q=Q/2;           //alert (q);           //q%=5;           //equivalent to q=q%5;           //alert (q);                //self-increment to decrement: + +--        //var r = N;        //var s = r++;        //Step one var s = r;        //Step Two r = r+1;        //alert (s);        //var s = ++r;        //Step one r= r+1;        //Step two var s = r;        //alert (s);        //var s = r--;        //Step one var s = r;        //Step two r=r-1;        //alert (s);        //var s =--r;        //Step one r=r-1;        //Step two var s = r;        //alert (s);                                                             //var aa = new Array ();alert (AA); 

JS Basic Knowledge Introduction

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.