1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Intercept the string one substring</title>6 </Head>7 <Body>8 <Script>9 /*string Interception*/Ten /* One Definition and Usage A The substr () method extracts a specified number of characters from the start subscript in a string. - Grammar - stringobject.substr (start,length) the parameter Description - start required. The starting subscript for the substring to extract. Must be numeric. If it is a negative number, the argument declares the position from the end of the string. That is,-1 refers to the last character in the string, 2 refers to the second-lowest character, and so on. - length is optional. The number of characters in the substring. Must be numeric. If this argument is omitted, then the string from the beginning of the stringobject to the end is returned. - return value + A new string that contains the length characters starting at the start of the Stringobject, including the character that the start refers to. If length is not specified, the returned string contains the character from start to the end of Stringobject. - */ + vara= "zxcvbnm"; A varb=A.substr (-3,2); at Console.log (b); - </Script> - </Body> - </HTML>
Intercept the string one substr