Summarize:
• The basic packing type is actually summed up, number and string type!!! Here are the properties and methods that I think are very common.
properties and methods for 1.Number
Property:
//static properties do not require a new 1. Min_value//Minimum Value 2. NaN//non-numeric 3. Negative_infinity//negative infinity, overflow return 4. Positive_infitity//infinity, overflow return 5. prototype//prototypes for adding new properties and Methods 6. Max_value//Maximum Valuesuch as: A1ert (Number.MAX_VALUE); alert (Number.NaN);
Method:
varbox=1000.75284; Alert (typeofbox); Alert (typeofBox.tostring ())//Convert a value to a stringAlert (box.tolocalestring ())//localizationAlert (box.tofixed (2))//the decimal point retains two bits and converts the stringAlert (box.toexponential ())//in exponential form, and converted into a stringAlert (Box.toprecision (3))//in exponential form, the argument is to retain the specified number of digits after the decimal point and convert to a string of 1.00E+3
Properties and methods for 2.String
Property:
// Normal Properties var box='string is string'; alert (box.length); // string length Alert (box.constructor) // returns the function that created the string object alert (box.prototype) // Expanding a string definition by adding properties and methods
Method:
// Character Method Alert (Box.charat (1)); // returns the specified subscript value, indexed starting from 0 T alert (box.charcodeat (1)); // return means to set the mark worth Ascall code
//string Manipulation MethodsAlert (Box.concat (' is','string','!!'));//concatenate string arguments into a string that invokes a methodAlert (Box.slice (2,5));//returns a string from 2 to 5 RinAlert (box.substring (2,5));//Ibid .Alert (BOX.SUBSTR (2,2));//Select 2 Ri from the second start
Note: It is not the same to distinguish between the character method and the string method.
//String Position methodAlert (Box.indexof ('R'))//returns the position of the first occurrence of the search from the initial position 2 cannot find the return-1Alert (Box.lastindexof ('R'))//returns the position of the first occurrence of the search r from the end positionAlert (Box.indexof ('R',5))//search starting from fifth positionAlert (Box.lastindexof ('R',5))//search forward from fifth position 2
Alert (Box.tolowercase ()) // convert to lowercase localization tolocalelowercase () alert (Box.touppercase ()) // convert to uppercase Ibid .
//string pattern matching methodAlert (Box.match ('R'))//returns the found string, unable to find the returned nullAlert (Box.search ('R'))//return position, cannot find return-1Alert (Box.replace ('R','Q'))//Replacealert (box); Alert (Box.split (' '))//separating the array with spaces as a standardAlert (Box)
Note: The string matching method appears after the alert (box) is in order to verify that the original object array has been altered, and that the validation has not changed.
JavaScript---Basic wrapper object