- The split() method is used to split a string into an array of substrings, and returns the array.
- The split() method does not change the original string.
Code:-
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <body>
- <h1>split()</h1>
- <input type="button" onclick="strfun();" value="Get Answer">
- <script>
- function strfun()
- {
- var str = "Place of Marthandam";
- alert(str.split(" ")); //return split by space
- }
- </script>
- </body>
- </html>
The split JavaScript:- Geniusofstudent
Reviewed by Network security
on
June 30, 2019
Rating:
No comments: