I won’t say much nonsense, just post code to everyone.
<!DOCTYPE html> <html> <head> <meta charset="{CHARSET}"> <title></title> </head> <body> </body> <script type="text/javascript"> //In Javascript script, split the string into an array according to the specified symbol and use the method of split() to split the string into an array according to the specified symbol.//Format ( char [,howmany]);//char: Required. String or regular expression howmany: optional.//This parameter can specify the maximum length of the returned array.//If this parameter is set, the returned substrings will not be more than the array specified by this parameter.//If this parameter is not set, the entire string will be split regardless of its length.var arr1="2:3:4:5".split(":"); (arr1+"<br/>"); (typeof(arr1)+"<br/>"); var arr2="|d|b|g".split("|"); (arr2+"<br/>"); (typeof(arr2)+"<br/>"); //If you want to split the word into letters or divide the string into characters, you can use the following code:var arr3="love".split(""); (arr3+"<br/>"); (typeof(arr3)+"<br/>"); //The above operation actually returns an array. To access a certain element, use arr[0], arr[1]......</script> </html>
The above is the usage of split() in JS introduced to you by the editor (split strings into arrays according to the specified symbols). I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!