I'm trying to get the values from an array so I can filter them. Using hints from Add single quotes in a string array javascript but it doesn't return the whole array with quotes around each value.
Tried:
var ages = Array.from({ length: 5 }, (_x, i) => i + 1);
console.log(ages); // [1,2,3,4,5]
ages = ages.toString();
console.log(ages); // "1,2,3,4,5"
const newArr = ages[0].split(",").map(x => x.trim());
console.log(newArr); // ["1"]
//desired: ["1","2","3","4","5",] or ["1","2","3","4","5"]