Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

i need to remove 1st single quote in this array using jquery

I created my function:

function call() {
    var value= [];
    var arr = data.split(',');
    for (i = 0; i < arr.length; i++) {
     var a = "'" + arr[i] + "'";
        value.push(a);
        alert(value);
    }
}

output is coming like this:

value='a','b','c','d';

but i need like this:

value=a','b','c','d;

helps are mostly appreciable. thank you

like image 576
Raj Avatar asked Feb 14 '23 00:02

Raj


1 Answers

I don't know why you want to do such thing, but you could achieve this just by simply join with ','

var arr = data.split(',');
alert(arr.join("','"))

Simple code simple life :)

like image 110
xdazz Avatar answered Feb 17 '23 02:02

xdazz