1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Document</title>6 </Head>7 <Body>8 <Script>9 //concat (): Connect two strings to return a new string and will not be modifiedTen varstr1= "Hello"; One varstr2= "123"; A varSTR3=Str1.concat (str2); - Console.log (str1); - Console.log (str2); the Console.log (STR3); - - varStr= "I Love my family!"; - Console.log (str); + //Slice (): intercepts a string based on index value and index value - Console.log (Str.slice (2)); //intercept from index to last + Console.log (Str.slice (2,5)); //intercept from index, package left not packet right A Console.log (Str.slice (-3)); //A couple of Countdown at Console.log (Str.slice (5,3)); //empty string - - //substr (): Intercept string based on index value and length - Console.log (Str.substr (2)); //intercept from index to last - Console.log (Str.substr (2,6)); //Intercept ~ length strings from an index - Console.log (Str.substr (-3)); //A couple of Countdown in - //substring (): Intercepting strings based on index and index values to Console.log (str.substring (2)); //intercept from index to last + Console.log (str.substring (2,5)); //Intercept ~ length strings from an index - Console.log (str.substring (-1)); //Intercept All the Console.log (str.substring (5,2)); //can only Exchange * </Script> $ </Body>Panax Notoginseng </HTML>
Connection and interception of JavaScript strings