Data type of javascript:
JavaScript data types are divided into two categories: original Type and Object type
original type:
number, String, Boolean, null, undefined
where null and undefined represent unique members
of their particular type Object type: An
object type is a collection of attributes, each of which is an unordered key-value pair when it is composed of a key-value pair, and an ordered key-value pair is
our array. There is
also a special object where the function
function is an object that has the executable code associated with it. Running executable code by calling a function and returning the result
if you use the new operator to create a new object, we call it a constructor
. Each constructor defines a class--a collection of object combinations that are initialized by constructors (which can be considered as subclasses of object types
)
Arrays are Class (array)
functional class (function)
dates are class (date)
regular class (REGEXP) classes
and functions run through JS always
Digital
JavaScript is not distinguishing between integers and floating-point numbers, and all numbers are represented by floating-point numbers
Math
Now we're going to get to know an object that has a lot to do with numbers, math, and this guy can do lots of things!
Math.Round (0.6) rounded
Math.random () generates a pseudo random number that is greater than 0 or less than 1
Operation Overflow
When the JS operation overflow will not error, will use Infinity infinity and infinitesimal-infinity said;
If there is no meaningful operation will return Nan,nan's judgment is false in any case (he is not equal to himself), so judge him to use the isNaN () function
Parseint and Parsefloat
parseint (string, radix)
Radix, which represents the base of the conversion, which we often say 2, 8, 10, 16 and so on. range from 2~36, but we generally call this method in JS, the basic is based on 10 of the conversion.
If the argument is less than 2 or greater than 36, parseint () returns NaN.
parseint This function is very useful, you can return a string as an integer
<script type= "Text/javascript" >
var a = parseint (' 334DD ');
var B = parseint (' 3D34DD ');
var c = parseint (' SS3D34DD ');
s = ';
</script>