0

I need to take the first 1000 digits of pi as strings in an array and return them into a new array as digits:

from this: ["1","4","1","5","9","2"...] (the full array of numbers is already provided in my assignment)
to this: [1, 4, 1, 5, 9, 2...]

I've tried creating a new variable with an empty array and using the .join method but when I console log it it returns the an empty array.

const strNums = ["1","4","1","5","9","2"...]
const newArray = [];
const integers = strNums.join(newArray);
console.log(newArray);
Jim
  • 13
  • 1
  • 1
  • 3

1 Answers1

1
const input = ["1","4","1","5","9","2"];
const output = input.map(Number);
Anton Harniakou
  • 855
  • 6
  • 13