remove the empty space from the array

by Subramanian 2012-09-15 10:50:59

function pica()
{

var NumberString =("100,200,,300,,500");

var scripts = NumberString.split(",");


for (i=0;i
{
var k=scripts[i];
k = k.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');

document.write(k);
}

}

Tagged in:

746
like
0
dislike
0
mail
flag

You must LOGIN to add comments