This function converts an array of strings into an array of numbers.
JavaScript:
let stringsToNumbers = arr => arr.map(Number);
// Example
console.log(stringsToNumbers(['1', '2', '3'])); // [1, 2, 3]
console.log(stringsToNumbers(['10', '20', '30'])); // [10, 20, 30]
TypeScript:
let stringsToNumbers = (arr: string[]): number[] => arr.map(Number);
// Example
console.log(stringsToNumbers(['1', '2', '3'])); // [1, 2, 3]
console.log(stringsToNumbers(['10', '20', '30'])); // [10, 20, 30]