How does JavaScript use the split () method
This article mainly introduces the relevant knowledge of "how JavaScript uses split () method". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how JavaScript uses split () method" can help you solve the problem.
JavaScript split () method
Definition and usage
The split () method is used to decompose a string into an array object.
Grammar
StringObject.split (separator,howmany)
Be careful
Note: if an empty character ("") is used as a delimiter, the string will be decomposed into an array of each contained character.
Example
In this example, we will decompose a string in two different ways:
Varstr= "Howareyoudoingtoday?" [xss_clean] (str.split (") +") [xss_clean] (str.split (") +") [xss_clean] (str.split (", 3))
The output is as follows:
How,are,you,doing,today? H,o,w,a,r,e,y,o,u,d,o,i,n,g,t,o,d,a,y,? This is the end of How,are,you 's introduction to "how JavaScript uses the split () method". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.