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]


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

//Pwede multiple arguments ilagay mo

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:

Top comments (0)

11 Tips That Make You a Better Typescript Programmer


1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields


Read the whole post now!