I have read the previous documents these days. When I see substring (), slice (), and substr (), I am not clear about the differences between them. After reading the materials and verifying them in person, I will make the following summary: first, define a variable to facilitate the following test: var str = 'q1207526854 'str. substring (form, to): truncates a string with the subscript form to the subscript to (excluding the characters corresponding to) alert (str. substring (2075) // when form> to, substring takes a smaller parameter as the first parameter alert (str. substring (6, 2) // 2075 and when one of the parameter values is negative, substring directly converts the negative number to 0. Alert (str. substring (6,-2) // q12075 reverse str. slice (star, end): extracts from a string whose subscript is star to whose subscript is end (excluding the character corresponding to end) alert (str. slice (2075) // when star> end, slice returns an empty string alert (str. slice (6, 2) // null when one of the parameter values is negative, slice will add the result of this parameter and the string length as the parameter alert (str. slice (6,-2) // 268 and slice can operate on arrays. ---------------------------------------------------- Str. substr (star, length): starting from a string whose subscript is star, truncates a substring of length, alert (str. substr (207526) // when star is a negative number, substr adds the result of this parameter to the string length as the parameter alert (str. substr (-6, 2) // 75 returns an empty string when the end value is negative. Alert (str. substr (6,-2) // null