Data types in JavaScript

Source: Internet
Author: User

Data types in JavaScript

Here are just a few simple notes!

//Boolean Type Drop   varA= ";//empty string converted to False   varb= ' 123 '//non-idling into true    varIsa=Boolean (a); varisb=Boolean (b); Alert (ISA); //falsealert (ISB);//ture    //so    functionshow001 () {varMessage= ' 123 '; if(message) {//A conversion is done by default here.Alert (' Not empty '); }Else{alert (' Empty. '); }    varValue//This declaration, however, is not assigned by default initialized to undefined    varobj=NULL;//if the variable will be used to receive a pointer to an object that is best assigned to a null empty objectAlert (Boolean (value)); if(value) {Alert (' True '); }Else{alert (' false ');//this is the line.    }        if(obj!=NULL){            }Else{        }    //therefore, in the declaration of variables, according to the actual situation to assign value;    //undefined null "//notice three kinds of empty values drop  }    //about Nan and isNaN ()    functionshow002 () {//determine if an X can be replaced with a number        //can be converted to non-Nan        //can't convert is NanAlert (IsNaN (NaN));//true        //Example One:        varTemp=parseint (' Blue ');       Alert (temp); //Result: NaNAlert (IsNaN (temp))//true cannot be converted to numeric value        //Example Two:        varStr= ' Red '; Alert (IsNaN (str))//true                varStrnum= ' 123 '; Alert (IsNaN (Strnum)); //false                //attention, even a special one!        varValue1=number (true);//1        varValue2=number (false);//0                //soAlert (IsNaN (true))//falseAlert (IsNaN (false))//false            }    //conversion between numeric types drop Yes    //number of values between the amount of exchange;    //Number parseint parsefloat ();

Data types in JavaScript

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.