The split JavaScript:- Geniusofstudent

  • 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:-


  1. <!DOCTYPE html> 
  2. <html> 
  3.  
  4. <head> 
  5.  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  6. </head> 
  7.  
  8. <body> 
  9.  
  10.  <h1>split()</h1> 
  11.  
  12.  <input type="button" onclick="strfun();" value="Get Answer"> 
  13.  
  14.  <script> 
  15.   function strfun() 
  16.   { 
  17.    var str = "Place of Marthandam"; 
  18.    alert(str.split(" ")); //return split by space 
  19.   } 
  20.  </script> 
  21.  
  22. </body> 
  23.  
  24. </html>
The split JavaScript:- Geniusofstudent The split JavaScript:- Geniusofstudent Reviewed by Network security on June 30, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.