Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Js judges whether it is plastic or not.
Js judges whether it is plastic or not.
First of all, there is no concept of int in js. What you want to judge is character type and numerical type.

Suppose the variable is not.

Code:

if(object . prototype . tostring . call(a)= '[object String]'){

//a is a character type.

}

The above code can determine whether A is a string type or a string object.

If (object.prototype.tostring.call (a) =' [object number]') {

//a is a numeric type.

}

The above code can determine whether A is a numeric type or a numeric object.