Javascript Tagalog - Array Reverse Method

mmvergara

mmvergara

Posted on August 19, 2022

Javascript Tagalog - Array Reverse Method

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 ]
Enter fullscreen mode Exit fullscreen mode

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 ]

Enter fullscreen mode Exit fullscreen mode

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,]

Enter fullscreen mode Exit fullscreen mode

More tagalog Javascript Learning Resources:
https://javascript-methods-in-tagalog.vercel.app/

💖 💪 🙅 🚩
mmvergara
mmvergara

Posted on August 19, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Javascript Tagalog - Array Reverse Method