DEV Community

Mark Matthew Vergara
Mark Matthew Vergara

Posted on • Updated on

 

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/

Oldest comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.