In JavaScript, objects usually include two types: built-in objects and browser objects. In addition, users can also customize objects.
An object contains two features:
1. A set of data used to describe the properties of an object, that is, severalvariable, commonly known asproperty。
2. Several actions used to operate the object's characteristics, that is, severalfunction, commonly known asmethod。
Object | meaning |
anchor | The name attribute is set in the current document |
applet | Mini programs in the current document |
area | Areas in client graphics map |
button | Buttons in the form |
checkbook | Checkboxes in the form |
document | HTML document in the current window |
embed | Embed object in the current window |
event | Events occurring in the browser |
fileUpload | File selection box in the form |
form | Forms in the current document |
frame | Frame in the current window |
hidden | Hide fields in the form |
history |
The history of the URL visited by the browser |
image | Graphics files in the current document |
link | The hyperlink with the href attribute set in the current document |
location | The URL of the browser currently displays the web page |
mimeType | Information on specific MIME types supported by the browser |
navigator | Current browser |
option | Options for the Options menu in the form |
password | Password box in form |
plugin | Plugins in the current browser |
radio | Radio box in form |
reset | Reset button in form |
screen | User screen |
select | Options menu in the form |
submit | Submit button in form |
text | Single line text box in form |
textarea | Multi-line text box in a form |
window | A frame in a browser window or window |
Built-in objects
Object;Object;Object;Object;Object;Object;Object;Object;Object;Object;Object;Object;Object;Object;Object;Object
Objects are array objects. Array elements can not only make other data types, but also other arrays or objects.
constructor | Returns a reference to the array function that created this object. |
index | |
input | |
length | Sets or returns the number of elements in the array. |
concat() | Concatenate two or more arrays and return the result. |
join() | Put all elements of the array into a string. Elements are separated by specified delimiters. |
pop() | Delete and return the last element of the array |
push() | Add one or more elements to the end of the array and return a new length. |
reverse() | Reverse the order of elements in the array. |
shift() | Delete and return the first element of the array |
slice() | Returns the selected element from an existing array |
sort() | Sort the elements of the array |
splice() | Delete the element and add new elements to the array. |
toSource() | Returns the source code of the object. |
toString() | Convert the array to a string and return the result. |
toLocaleString() | Convert the array to a local array and return the result. |
unshift() | Add one or more elements to the beginning of the array and return a new length. |
valueOf() | Returns the original value of the array object |
Objects can access Boolean values as objects and change parameters to Boolean values.
Boolean object properties | describe |
constructor | Returns a reference to the Boolean function that created this object |
prototype | Add properties and methods to objects |
Boolean object method | describe |
toSource( ) | Returns the source code of the object. |
toString( ) | Convert the logical value to a string and return the result |
valueOf( ) | Returns the original value of the Boolean object. |
Objects are used to process dates and times.
Date object properties | describe |
constructor | Returns a reference to the Date function that created this object. |
prototype | Gives you the ability to add properties and methods to objects. |
Date() | Returns the date and time of the day. |
getDate() | Returns a day of the month from the Date object (1 ~ 31). |
getDay() | Returns a day of the week from the Date object (0 ~ 6). |
getMonth() | Returns month (0 ~ 11) from the Date object. |
getFullYear() | Returns the year as four digits from the Date object. |
getYear() | Please use the getFullYear() method instead. |
getHours() | Returns the hours (0 ~ 23) of the Date object. |
getMinutes() | Returns the minutes of the Date object (0 ~ 59). |
getSeconds() | Returns the number of seconds (0 ~ 59) of the Date object. |
getMilliseconds() | Returns milliseconds (0 ~ 999) of the Date object. |
getTime() | Returns the number of milliseconds from January 1, 1970 to present. |
getTimezoneOffset() | Returns the minute difference between local time and Greenwich Standard Time (GMT). |
getUTCDate() | Returns a day in the month from the Date object according to world time (1 ~ 31). |
getUTCDay() | Returns the day of the week from the Date object according to world time (0 ~ 6). |
getUTCMonth() | Returns month (0 ~ 11) from Date object according to world time. |
getUTCFullYear() | Returns a four-digit year from a Date object based on world time. |
getUTCHours() | Returns the hour (0 ~ 23) of the Date object according to world time. |
getUTCMinutes() | Returns the minutes of the Date object (0 ~ 59) based on world time. |
getUTCSeconds() | Returns the seconds (0 ~ 59) of the Date object according to the world time. |
getUTCMilliseconds() | Returns milliseconds of the Date object (0 ~ 999) based on world time. |
parse() | Returns the number of milliseconds from midnight on January 1, 1970 to the specified date (string). |
setDate() | Sets a day of the month in the Date object (1 ~ 31). |
setMonth() | Sets the month (0 ~ 11) in the Date object. |
setFullYear() | Sets the year (four digits) in the Date object. |
setYear() | Please use the setFullYear() method instead. |
setHours() | Sets the hours (0 ~ 23) in the Date object. |
setMinutes() | Sets the minutes (0 ~ 59) in the Date object. |
setSeconds() | Sets the seconds (0 ~ 59) in the Date object. |
setMilliseconds() | Sets milliseconds (0 ~ 999) in the Date object. |
setTime() | Sets the Date object in milliseconds. |
setUTCDate() | Sets the day of the month in the Date object according to world time (1 ~ 31). |
setUTCMonth() | Sets the month (0 ~ 11) in the Date object according to world time. |
setUTCFullYear() | Sets the year (four digits) in the Date object according to world time. |
setUTCHours() | Sets the hours (0 ~ 23) in the Date object according to world time. |
setUTCMinutes() | Sets minutes in the Date object according to world time (0 ~ 59). |
setUTCSeconds() | Sets the seconds (0 ~ 59) in the Date object according to world time. |
setUTCMilliseconds() | Set milliseconds (0 ~ 999) in the Date object according to world time. |
toSource() | Returns the source code of the object. |
toString() | Converts the Date object to a string. |
toTimeString() | Converts the time part of the Date object to a string. |
toDateString() | Converts the date part of the Date object to a string. |
toGMTString() | Please use the toUTCString() method instead. |
toUTCString() | Convert the Date object to a string based on the world time. |
toLocaleString() | Convert the Date object to a string according to the local time format. |
toLocaleTimeString() | Convert the time part of the Date object to a string according to the local time format. |
toLocaleDateString() | Convert the date part of the Date object to a string according to the local time format. |
UTC() | Returns the number of milliseconds from January 1, 1997 to the specified date according to the world time. |
valueOf() | Returns the original value of the Date object. |
Objects are used for mathematical calculations, Math objects can be used without using constructors, and all properties and methods are static.
E | Returns the arithmetic constant e, that is, the base number of the natural logarithm (approximately equal to 2.718). | 1 | 3 |
LN2 | Returns the natural logarithm of 2 (approximately equal to 0.693). | 1 | 3 |
LN10 | Returns a natural logarithm of 10 (approximately equal to 2.302). | 1 | 3 |
LOG2E | Returns the logarithm of e with base 2 (approximately equal to 1.414). | 1 | 3 |
LOG10E | Returns the logarithm of e with base 10 (approximately equal to 0.434). | 1 | 3 |
PI | Returns Pi (approximately equal to 3.14159). | 1 | 3 |
SQRT1_2 | Returns the inverse of the square root of 2 (approximately equal to 0.707). | 1 | 3 |
SQRT2 | Returns the square root of 2 (approximately equal to 1.414). | 1 | 3 |
abs(x) | Returns the absolute value of the number. | 1 | 3 |
acos(x) | Returns the inverse cosine value of the number. | 1 | 3 |
asin(x) | Returns the inverse sine value of the number. | 1 | 3 |
atan(x) | Returns the arctangent value of x as a value between -PI/2 and PI/2 radians. | 1 | 3 |
atan2(y,x) | Returns the angle from the x-axis to the point (x,y) (between -PI/2 and PI/2 radians). | 1 | 3 |
ceil(x) | Round up the logarithm. | 1 | 3 |
cos(x) | Returns the cosine of the number. | 1 | 3 |
exp(x) | Returns the index of e. | 1 | 3 |
floor(x) | Round down the logarithm. | 1 | 3 |
log(x) | Returns the natural logarithm of the number (bottom is e). | 1 | 3 |
max(x,y) | Returns the highest value in x and y. | 1 | 3 |
min(x,y) | Returns the lowest value in x and y. | 1 | 3 |
pow(x,y) | Returns the y power of x. | 1 | 3 |
random() | Returns a random number between 0 and 1. | 1 | 3 |
round(x) | Round the number into the closest integer. | 1 | 3 |
sin(x) | Returns the sine of the number. | 1 | 3 |
sqrt(x) | Returns the square root of the number. | 1 | 3 |
tan(x) | Returns the tangent of the angle. | 1 | 3 |
toSource() | Returns the source code of the object. | 1 | - |
valueOf() | Returns the original value of the Math object. | 1 | 4 |
Objects can be accessed as objects, just like Math, without creating objects, use them directly.
constructor | Returns a reference to the Number function that created this object. | 1.0 | 4.0 |
MAX_VALUE | The largest number that can be represented. | 1.0 | 4.0 |
MIN_VALUE | The smallest number that can be represented. | 1.0 | 4.0 |
NaN | Non-numeric value. | 1.0 | 4.0 |
NEGATIVE_INFINITY | Negative infinity, returns this value when overflowing. | 1.0 | 4.0 |
POSITIVE_INFINITY | It is infinity and returns this value when overflowing. | 1.0 | 4.0 |
prototype | Gives you the ability to add properties and methods to objects. | 1.0 | 4.0 |
toString | Converts numbers to strings, using the specified cardinality. | 1.0 | 4.0 |
toLocaleString | Convert numbers to strings, using local numeric format order. | 1.0 | 4.0 |
toFixed | Converts a number into a string, and the result has a number of specified digits after the decimal point. | 1.0 | 5.5 |
toExponential | Convert the object's value to exponential counting method. | 1.0 | 5.5 |
toPrecision | Format the number to the specified length. | 1.0 | 5.5 |
valueOf | Returns the basic numeric value of a Number object. | 1.0 | 4.0 |
An object is an object that derives all other objects, and its properties and methods can be derived to all other objects.
property | describe |
constructor | The name of the constructor representing the object |
prototype | Used to add new properties and methods to objects |
method | describe |
toString( ) | Convert an object to be represented by a string |
valueOf( ) | Get the original value of the specified object |
Objects represent regular expressions, which are powerful tools for performing pattern matching on strings. slightly...
Objects are used to process text (strings).
constructor | Reference to the function that created the object | 1 | 4 |
length | The length of the string | 1 | 3 |
prototype | Allows you to add properties and methods to objects | 1 | 4 |
anchor() | Create HTML anchor. | 1 | 3 |
big() | Display strings in large fonts. | 1 | 3 |
blink() | Shows the flashing string. | 1 | |
bold() | Display strings in bold. | 1 | 3 |
charAt() | Returns the character at the specified position. | 1 | 3 |
charCodeAt() | Returns the Unicode encoding of the characters at the specified location. | 1 | 4 |
concat() | Connect string. | 1 | 4 |
fixed() | Displays strings in typewriter text. | 1 | 3 |
fontcolor() | Use the specified color to display the string. | 1 | 3 |
fontsize() | Use the specified size to display the string. | 1 | 3 |
fromCharCode() | Create a string from character encoding. | 1 | 4 |
indexOf() | Search string. | 1 | 3 |
italics() | Use italics to display the string. | 1 | 3 |
lastIndexOf() | Search for strings from back to front. | 1 | 3 |
link() | Displays the string as a link. | 1 | 3 |
localeCompare() | Compare two strings in a locally specific order. | 1 | 4 |
match() | Find a match for one or more expressions. | 1 | 4 |
replace() | Replace substrings that match the regular expression. | 1 | 4 |
search() | Searches the value that matches the regular expression. | 1 | 4 |
slice() | Extracts fragments of the string and returns the extracted part in the new string. | 1 | 4 |
small() | Use small font size to display strings. | 1 | 3 |
split() | Split the string into a string array. | 1 | 4 |
strike() | Use strikethrough to display strings. | 1 | 3 |
sub() | Display the string as a subscript. | 1 | 3 |
substr() | Extract the specified number of characters from the string from the starting index number. | 1 | 4 |
substring() | Extracts the character between two specified index numbers in the string. | 1 | 3 |
sup() | Display the string as a superscript. | 1 | 3 |
toLocaleLowerCase() | Convert string to lowercase. | - | - |
toLocaleUpperCase() | Convert string to uppercase. | - | - |
toLowerCase() | Convert string to lowercase. | 1 | 3 |
toUpperCase() | Convert string to uppercase. | 1 | 3 |
toSource() | The source code representing the object. | 1 | - |
toString() | Returns the string. | - | - |
valueOf() | Returns the original value of a string object. | 1 | 4 |
Objects can access functions as objects and can dynamically generate and call functions during script execution.
property | describe |
arguments | Array of function parameters |
caller | Indicates calling the currently executing function |
prototypt | Add new properties and methods to the object |
method | |
apply() | Used to apply methods from one object to another |
call(this);call(this,arg1,arg2...) | Methods that allow calling another object |
toString | Used to convert an object into a string |
The above article briefly discusses the built-in objects and browser objects of JavaScript are all the content I have shared with you. I hope you can give you a reference and I hope you can support me more.