Do split() in javascript and ignore blank entries - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

Do split() in javascript and ignore blank entries

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//from  www  . j  a  v a  2 s.c o  m
var string = "How; are;you ;my  ;friend? tha;asf;a;dfa;df;a;df;ad;fa;sdf;a;sdf235;42;34;23;4;234;2;34";
var arr = string.split(";");
console.log(arr);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials