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/

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

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