javascript reverse each string element in array 1

javascript reverse each string element in array

let noArray_leftOdd = ['0001101', '0011001', '0010011', '0111101'];

console.log(noArray_leftOdd.map(e => e.split("").reverse().join("")));

Here is what the above code is Doing:
1. It’s taking the array of odd numbers and reversing the order of the digits.
2. It’s then mapping the array to a new array, where each element is the reversed array, split into an array of digits, reversed again, and then joined back into a string.

The result is an array of even numbers, in the same order as the original array.

Similar Posts