DEV Community

mmvergara
mmvergara

Posted on • Edited on

2 1

Javascript Tagalog - Array Push Method

Ano ngaba ang Array Push method sa Javascript
Yung array push method ay basta magpu-push lang siya ng value sa array.

Pano Gamitin:

const arr = [0,1,2]

arr.push(3)

console.log( arr ) // [0,1,2,3]

//Pwede multiple arguments ilagay mo
arr.push(4,5)

console.log( arr ) // [0,1,2,3,4,5]
Enter fullscreen mode Exit fullscreen mode

diba? easy lang!.

Return Value
ano yung value if lalagay mo siya sa variable?

const arr = [0,1,2]

const returnValue = arr.push(3)
console.log( returnValue ) // 4
Enter fullscreen mode Exit fullscreen mode

yung return value ng push method is yung bagong length ng array after natin maglagay ng bagong element


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

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay