i got an array of numbers [12345,345653,456356]but i need to convert this to something like [[1232131],[234324],[67657]]for using a CSV react component tool that reads data using this format. Do you got some idea how to make this? i tried this using push but i dont get the correct format.
Add a comment
|
2 Answers
You can simply use .map() to create a new array based on existing one:
let input = [12345,345653,456356];
let output = input.map(x => [x]);
console.log(output);