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