当前位置:网站首页>Array, date, string object method

Array, date, string object method

2022-07-05 08:48:00 Front end Jiang Taigong

Array Object methods

Method describe concat() Join two or more arrays , And return the result . copyWithin() Copy elements from the specified location of the array to another specified location of the array . entries() Returns the iteratable object of the array . every() Checks whether each element of a numeric element is eligible . fill() Fill the array with a fixed value . filter() Detect value elements , And returns an array of all elements that meet the criteria . find() Return compliance with incoming test ( function ) Conditional array elements . findIndex() Return compliance with incoming test ( function ) Conditional array element index . forEach() Each element of the array performs a callback function . from() Create an array from the given object . includes() Determine whether an array contains a specified value . indexOf() Search for elements in the array , And return to where it is . isArray() Determine whether the object is an array . join() Put all the elements of the array into a string . keys() Returns the iteratable object of the array , Contains the key of the original array (key). lastIndexOf() Search for elements in the array , And return to where it last appeared . map() Handle each element of the array by specifying a function , And return the processed array . pop() Delete the last element of the array and return the deleted element . push() Add one or more elements... To the end of the array , And returns the new length . reduce() Evaluate an array element to a value ( From left to right ). reduceRight() Evaluate an array element to a value ( From right to left ). reverse() Reverse the order of elements in an array . shift() Delete and return the first element of the array . slice() Pick a part of the array , And return a new array . some() Check whether any element in the array element meets the specified conditions . sort() Sort elements of an array . splice() Add or remove elements from an array . toString() Convert an array to a string , And return the result . unshift() Add one or more elements to the beginning of an array , And returns the new length . valueOf() Returns the original value of the array object .

Date Object methods

Method describe getDate() from Date Object returns a day of the month (1 ~ 31). getDay() from Date Object returns a day of the week (0 ~ 6). getFullYear() from Date Object returns the year... In four digits . getHours() return Date The hour of the object (0 ~ 23). getMilliseconds() return Date Object's milliseconds (0 ~ 999). getMinutes() return Date Object's minutes (0 ~ 59). getMonth() from Date Object returns the month (0 ~ 11). getSeconds() return Date The number of seconds of the object (0 ~ 59). getTime() return 1970 year 1 month 1 Millisecond of day to date . getTimezoneOffset() Return to local time and Greenwich mean time (GMT) The minute difference . getUTCDate() According to the universal time from Date Object returns the day of the month (1 ~ 31). getUTCDay() According to the universal time from Date Object returns a day of the week (0 ~ 6). getUTCFullYear() According to the universal time from Date Object returns a four digit year . getUTCHours() Return according to universal time Date The hour of the object (0 ~ 23). getUTCMilliseconds() Return according to universal time Date Object's milliseconds (0 ~ 999). getUTCMinutes() Return according to universal time Date Object's minutes (0 ~ 59). getUTCMonth() According to the universal time from Date Object returns the month (0 ~ 11). getUTCSeconds() Return according to universal time Date The second of the object (0 ~ 59). getYear() obsolete . Please use getFullYear() Methods to replace . parse() return 1970 year 1 month 1 From midnight to the appointed date ( character string ) Millisecond count . setDate() Set up Date One day of the month in the object (1 ~ 31). setFullYear() Set up Date The year in the object ( Four digit number ). setHours() Set up Date The hours in the object (0 ~ 23). setMilliseconds() Set up Date Milliseconds in the object (0 ~ 999). setMinutes() Set up Date Minutes in the object (0 ~ 59). setMonth() Set up Date The month of the object (0 ~ 11). setSeconds() Set up Date Seconds in object (0 ~ 59). setTime() setTime() Method is set in milliseconds Date object . setUTCDate() Set according to universal time Date One day of the month in the object (1 ~ 31). setUTCFullYear() Set according to universal time Date The year in the object ( Four digit number ). setUTCHours() Set according to universal time Date The hours in the object (0 ~ 23). setUTCMilliseconds() Set according to universal time Date Milliseconds in the object (0 ~ 999). setUTCMinutes() Set according to universal time Date Minutes in the object (0 ~ 59). setUTCMonth() Set according to universal time Date Month in object (0 ~ 11). setUTCSeconds() setUTCSeconds() Method is used according to universal time (UTC) Set the second field of the specified time . setYear() obsolete . Please use setFullYear() Methods to replace . toDateString() hold Date The date part of the object is converted to a string . toGMTString() obsolete . Please use toUTCString() Methods to replace . toISOString() Use ISO The date format of the standard return string . toJSON() With JSON Return date string in data format . toLocaleDateString() According to the local time format , hold Date The date part of the object is converted to a string . toLocaleTimeString() According to the local time format , hold Date The time part of the object is converted to a string . toLocaleString() According to the local time format , hold Date Object to string . toString() hold Date Object to string . toTimeString() hold Date The time part of the object is converted to a string . toUTCString() According to the world time , hold Date Object to string . example : var today = new Date(); var UTCstring = today.toUTCString(); UTC() Return according to universal time 1970 year 1 month 1 Japan The number of milliseconds to the specified date . valueOf() return Date The original value of the object .

String Object methods

Method describe charAt() Returns the character in the specified position . charCodeAt() Returns the... Of a character in a specified position Unicode code . concat() Connect two or more strings , And return the new string . fromCharCode() take Unicode Code to character . indexOf() Returns the first occurrence of a specified string value in a string . includes() Find if the string contains the specified substring . lastIndexOf() Search string from back to front , And from the beginning (0) Start calculating the last occurrence of the return string . match() Find a match for one or more regular expressions . repeat() Copy string specified number of times , And connect them back together . replace() Find the matching substring in the string , And replace the substring that matches the regular expression . search() Find the value that matches the regular expression . slice() Extract a fragment of a string , And return the extracted part in the new string . split() Split a string into an array of strings . startsWith() See if the string starts with the specified substring . substr() Extract the specified number of characters in the string from the starting index number . substring() Extract the character between two specified index marks in the string . toLowerCase() Convert string to lowercase . toUpperCase() Convert strings to uppercase . trim() Remove the white space on both sides of the string toLocaleLowerCase() Convert strings to lowercase according to the locale of the local host . toLocaleUpperCase() Convert strings to uppercase based on the locale of the local host . valueOf() Returns the original value of a string object . toString() Returns a string .

原网站

版权声明
本文为[Front end Jiang Taigong]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050842305961.html