DEV Community

mmvergara
mmvergara

Posted on • Updated on

Javascript Tagalog - Array Unshift Method

Ano ngaba ang Array Pop method sa Javascript?
yung Array unshift method sa javascript is maglalagay siya ng values sa unahan ng array

Pano gamitin:

const arr = [4,5]

arr.unshift(3)

console.log( arr ) // [3,4,5]

//Pwede multiple arguments ilagay mo
arr.unshift(1,2)

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

Enter fullscreen mode Exit fullscreen mode

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


const arr = [2,3]

const returnValue = arr.unshift(1)

console.log( returnValue ) // 3

Enter fullscreen mode Exit fullscreen mode

yung return value ng unshift 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)