JavaScript Reverse Array
var arr = [34, 234, 567, 4];
print(arr);
var new_arr = arr.reverse();
print(new_arr);
Black Footed Ferret
var arr = [34, 234, 567, 4];
print(arr);
var new_arr = arr.reverse();
print(new_arr);
const solution = (str) => str.split("").reverse().join("");
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
const arr = [34, 234, 567, 4];
console.log(arr);
const new_arr = arr.reverse();
console.log(new_arr);
var arr = [1, 2, 3, 4, 5, 6, 7];
console.log (arr.reverse ());
for (i = 0; i < arr.length / 2; i++) {
var temp = arr[i];
temp =arr[arr.length - 1 - i];
temp = temp;
}
console.log (arr);
// reverse massive
var arr = [1, 2, 3, 4, 5];
console.log(arr); // [1, 2, 3, 4, 5]
console.log(arr.reverse()); // [ 5, 4, 3, 2, 1 ]