9
I have a string thus ...
var listAdd = "1789, 3, 8 , 1788, 3, 8, 1790, 3, 9"
How do I convert into a array as below?
[1789,3,8], [1788,3,8], [1790,3,9]
The code I’m trying isn’t working:
var ArrayAdd = new Array();
for (i = 0; i < listAdd.length; i++) {
s = "";
s = String(listAdd[i]);
ArrayAdd.push(s);
}
Do you need to create an array every three positions? Or do you have some other criteria?
– leofalmeida
That’s right .... no more criteria!
– Alexandre Moss
Possible duplicate of Split array into smaller groups
– Sorack