all things in JavaScript are objects: strings, arrays, numbers, functions ...1, each object with properties and methods
JavaScript allows custom objects
2. Custom Objects
A. Define and create an object instance
B. Use a function to define the object, and then create a new object instance
Second, JS built-in object-string1. String Object
String object to handle an existing string
strings can use single or double quotation marks
2, IndexOf () find the string in the string, if the match successfully returns the position of the first letter, otherwise return-1
3. Match ()Match succeeds, returns an array of successful matches, otherwise returns null
4. ReplaceStr.replace (Find the character, new string) matches successfully, with new character to replace match successful character
5. Convert toUpperCase () to uppercase
Common properties and methods include the following:
Properties: Length, prototype, constructor
Methods: CharAt (), charCodeAt (), concat (), IndexOf (), Match (), replace (), search (), slice (), substring (), substr (), ValueOf (), toLowerCase (), toUpperCase (), Split ()
Third, JS built-in object-date date1. Date Object
Date objects are used to process dates and times
2. Date of the day of acquisition
3, the common method:
Year of Acquisition: getFullYear ()
Get month: GetMonth (+1)
Date taken: GetDate ()
Get week: GetDay ()
Get Hours: Gethour ()
Get minutes: getminutes ()
Get seconds: getseconds ()
Get milliseconds: GetTime ()
Four, JS built-in object-array1. Array Object
Use a separate variable name to store a series of values
2. Creation of arrays
Eg:var Myarr = ["Hello", "World", "HI"]
3. Access to arrays
You can access a specific element by specifying the array name and the index number
Note: [0] is the first element of the array. [1] is the second element of the array
4. Common methods of arrays:
Concat () Merging arrays
Sort () sorting
Append element at end of push (), return length
Reverse () array element rollover
Five, JS built-in object-math1. Math Object
Perform common arithmetic tasks
2, the common method:
Rounding: Round ()
Returns the random number between 0~1: Random ()
Return highest value: Max ()
Return lowest value: Min ()
Return absolute Value: ABS ()
JS built-in object-string, Date Date object, array array object, Math object