JS data types are divided into primitive types (num, String, Boolean), Object types (objects, collections of attributes, special objects are arrays, global objects ), primitive values (null,undefined), except for primitive values, others have methods
JS is flexible for data type conversion
Attention:
1, Number type: overflow in arithmetic operation, underflow, or divide by zero will not error,
If the overflow result is infinite, it returns infinity, and negative infinity returns-infinity
If the result of the next overflow operation is infinitely close to 0, and is smaller than the minimum value that JS can represent, the return value is zero.
If divide by zero: Returns Infinity or-infinity, but 0/0, infinity divided by infinity, negative as root, and results return Nan
Objects (global objects, wrapper objects)
Global objects:
Wrapper object: Package properties and methods, such as var s = "abc"; Return S.LENGTH;//3
At the same time, = = is the same as the non-strict meaning, = = = Equal in strict sense
Mutable objects: such as var x = {O:1}; X.O = 2;return X;//2
A summary of some of the methods:
Time Method:
var t = new Date (2016,3,3);//April 3, 2016
var t = new Date (2016,3,3,17,10,30);//April 3, 2016 17:10:30
var t = new Date ();//Current time
T.getfullyear ();//2016
t.getmonth;//3--calculates the month starting from 0, so it's actually April.
T.getdate ();//3rd--counting days starting from 1
T.getday (); 0 Sunday--6 for Saturday
Method of String:
S.chatat (0); first character
S.chat (s.length-1); last character
S.substring (1,4); 第2-4个 character
S.slice (1,4); 第2-4个 character
S.indexof (' l '); The position of the first occurrence of the character L
S.lastindexof ("L"); the position of the last occurrence of the character I
S.indexof ("L", 3); position of L at first appearance after position 3
S.split (","); split into sub-strings
S.replace ("H", "H"); character substitution
S.topuppercase (); string capitalization
Regexp ();
JS Summary of data types