Ano ngaba ang Array Reverse method sa Javascript?
yung Array Reverse method sa javascript, rereverse niyalang yung original array.
Pano gamitin:
const arr = [1,2,3]
arr.reverse()
console.log( arr ) // [3, 2, 1 ]
Return Value
ano yung value if lalagay mo siya sa variable?
const arr = [1,2,3]
const returnValue = arr.reverse()
console.log( returnValue ) // [3, 2, 1 ]
return value ng reverse method is yung reversed na array, but becareful kasi same parin yung address sa memory so pag pinalitan mo or minodify mo yung returnValue variable, mapapalitan din yung arr variable
const arr = [1,2,3]
const returnValue = arr.reverse()
returnValue.pop()
console.log( arr ) // [3, 2,]
console.log( returnValue ) // [3, 2,]
More tagalog Javascript Learning Resources:
https://javascript-methods-in-tagalog.vercel.app/