Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[JavaScript] Convert string array to integer array and reverse

let arrayOfStrings = ["1","2","3","4"]

let arrayOfNumbers = arrayOfStrings.map(Number)
console.log(arrayOfNumbers) // [1,2,3,4]

arrayOfStrings = arrayOfNumbers.map(String)
console.log(arrayOfStrings ) //["1","2","3","4"]

Leave a Reply

Your email address will not be published. Required fields are marked *