Home > Article > Web Front-end > What are the common methods of JavaScript built-in objects?
Commonly used methods of built-in objects: concat(), join(), pop(), shift(), slice(), splice(), push(), sort(), reverse(), toLocaleString( ), escape(), eval(), etc.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Commonly used built-in objects in JS: Array object, Date object, string object, Global object
concat( ) Indicates merging several arrays into one array
join() Set the separator to connect the array elements into a string
pop() Remove the last element of the array
shift() Remove the first element of the array
slice(start, end) Return to the array A section of
splice() can be used to delete, insert, or replace
push() to the array Add a new element and return the latest length
sort() Sort the array
reverse() Reverse the order of the array
toLocaleString() Convert the array to a local string
Global properties and functions can be used All built-in JavaScript objects
escape() Encoding string
eval() Parse the string into JavaScript code and execute it
isNaN()
##parseFloat() Parse a string and return a floating point number##concat() Concatenate two or more strings
match() Use The regular expression pattern performs a search on a string and returns the result containing the search result
replace() Replaces a substring that matches the regular expression
search() Retrieve substrings in a string that match a regular expression. If no match is found, -1 is returned.
slice(start, end) Intercept the substring according to the following table
substring(start, end) Intercept the substring according to the following table
substr( start, length) Truncate the string according to its length
parse function: Returns the number of milliseconds since 0:00 on January 1, 1970 (local time)
setDate function: Set date The "day" part has a value of 0 to 31.
setHours function: Set the "hour" part of the date, the value is 0~23.
setMinutes function: Set the "minutes" part of the date, the value is 0~59.
setMonth function: Set the "month" part of the date, the value is 0~11. Among them, 0 represents January, ..., and 11 represents December.
setSeconds function: Set the "seconds" part of the date, the value is 0~59.
setTime function: Set time. The time value is the number of milliseconds since 00:00 on January 1, 1970.
setYear function: Set the "year" part of the date.
toGMTString function: Convert the date into a string, which is GMT Greenwich Mean Time.
setLocaleString function: Convert the date into a string, which is the local time.
Programming Video! !
The above is the detailed content of What are the common methods of JavaScript built-in objects?. For more information, please follow other related articles on the PHP Chinese website!