How can I convert the elements of the array into another array?
let a = [2, 4, 0, 8, 9, 15]
and the result will be :
a = [[2],
Use Array#map to iterate the array, and wrap each item in an array:
let a = [2, 4, 0, 8, 9, 15] const result = a.map((n) => [n]) console.log(JSON.stringify(result))