Deena P Deena P - 1 year ago 86
Javascript Question

convert an array of objects to a dataset that can be feed into a jquery datatable

I have an array like below one,

["abc", "xyz", "mno"]

now I want to convert it into an another array which has wrapped each element with a square bracket, like below one

["abc"], ["xyz"], ["mno"]

so I can use this dataset to create single column datatable.

Answer Source

var a = ["abc", "xyz", "mno"];
var aa = [];
for(i in a){

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download