I am trying to get the array in the below format, However anything I try breaks one thing or the other
const arr = ['0', '1000', '2000', '3000', '4000'];
const desiredFormat = [];
const chunkSize = 2;
while (arr.length > 0) {
desiredFormat.push(arr.splice(0, chunkSize).join(","));
}
console.log("RESSSULTTT",desiredFormat)
Actual Value returned
['0,1000', '2000,3000', '4000']
Desired Format
['0,1000','2000,3000', '3000,4000']