Thursday, August 16, 2012

javascript – copying one array to another array

I am an array in following format. I am reading following data from a file data.json like this



$.getJSON(\'data/data.json\', function (ids) {
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
teams = id;
$(\'<li>\' + id + \'</li>\').appendTo(span);

}
});


here is data



[
\"109 200\",
\"109 201\",
\"102 202\",
\"103 202\"
]


So what I want is to copy this array to another lets say c but in following form



[
\"109\",
\"109\",
\"102\",
\"103\",
\"200\",
\"201\",
\"202\",
\"202\"
]


How can I do this using javascript or jquery?






Rating: 1 out of 5 based on 3 ratings



The post javascript – copying one array to another array appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-copying-one-array-to-another-array.html

No comments:

Post a Comment