DEV Community

mmvergara
mmvergara

Posted on • Edited on

1

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/

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay