1<script>2 math.random ()3 4 5 Date-time functions (which need to be called with variables):6 varb =NewDate ();//Get current Time7B.gettime ()//Get time stamp8B.getfullyear ()//Get year9B.getmonth (+1);//Get MonthTenB.getdate ()//Get Day OneB.gethours ()//Get Hours AB.getminutes ()//Get minutes -B.getseconds ()//gets the number of seconds -B.getday ()//get the day of the week theB.getmilliseconds ()//get milliseconds -Date ()//get the full date - - + mathematical functions (called with math): - ABS (x) The absolute value of the return number. + ceil (x) is rounded on the logarithm. A Floor (x) is rounded down with a logarithmic. at round (x) rounds the number to the nearest integer. - Max (x, y) returns the highest value in X and Y. - min (x, y) returns the lowest value in X and Y. - the POW (x, y) returns the y power of X. - sqrt (x) returns the square root of the number. -Random () returns an arbitrary number between 0 and 1. **** in - String functions (called with variables): to + indexOf -Returns the index (from left to right) of the first occurrence of a substring in a string. If there is no match, return-1. the varIndex1 = A.indexof ("L"); * //index1 = 2 $ Panax Notoginseng charAt - returns the character at the specified position. the varGet_char = A.charat (0); + //Get_char = "h" A the lastIndexOf +Returns the index (right-to-left search) at the last occurrence of a substring in a string, or 1 if there are no matches. - varindex1 = lastIndexOf (' l ')); $ //index1 = 3 $ - - Match theCheck that a string matches a regular expression content, if there is a match to returnNULL. - varRe =NewREGEXP (/^\w+$/);Wuyi varIS_ALPHA1 =A.match (re); the //is_alpha1 = "Hello" - varIS_ALPHA2 =B.match (re); Wu //IS_ALPHA2 = null - About substring $ returns a substring of a string in which the incoming parameter is the starting and ending position. - - varSub_string2 = a.substring (1,4); - //sub_string2 = "ell" A +SUBSTR ******** the returns a substring of a string in which the incoming parameter is the starting position and length - varSub_string1 = A.SUBSTR (1); $ //sub_string1 = "Ello" the varSub_string2 = A.substr (1,4); the //sub_string2 = "Ello" the theReplace ******* - Replace String, the first argument represents the replaced string, the second argument represents the replacement string inA.replace ("he", "AA")) the the About Search thePerforms a regular expression matching lookup. If the lookup succeeds, returns the matching index value in the string. Otherwise returns-1. the varIndex1 =A.search (re); the //index1 = 0 + varIndex2 =B.search (re); - //index2 =-1 the BayiSplit ****** the A string is made into a string array by dividing the string into substrings. the vararr1 = A.split (""); - //arr1 = [H,e,l,l,o] - theLength property ******* the returns the length of a string, which refers to the number of characters it contains. the the - toLowerCase the turns the entire string into lowercase letters. the varLower_string =a.tolowercase (); the //lower_string = "Hello"94 the toUpperCase the turns the entire string into uppercase. the varUpper_string =a.touppercase ();98 //upper_string = "HELLO" About -</script>
The above is the outline of the way to lecture
JS Basic finishing (basic functions, common methods) content in class