“JavaScript arrray loop mundur” Kode Jawaban

JS Loop Array mundur

let arr = [1, 2, 3];
arr.slice().reverse().forEach(x => console.log(x))
Friendly Hawk

JavaScript arrray loop mundur


let reverseArray = Arr=>{
  let pushed =[];
  for(let i = Arr.length -1; i >= 0; i--){
     pushed.push(Arr[i]);
  }
  return pushed
}



const sentence = ['sense.','make', 'all', 'will', 'This'];

 console.log(reverseArray(sentence)) 
// Should print ['This', 'will', 'all', 'make', 'sense.'];
EMMANUEL

Jawaban yang mirip dengan “JavaScript arrray loop mundur”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya