DEV Community

loading...

Discussion on: How to duplicate array

Collapse
elukuro profile image
Heru Hartanto Author

I did this 😆

const a =[1,2,3]
const b = a.slice()
b.push(4)
console.log(a,b)
Enter fullscreen mode Exit fullscreen mode
Collapse
madrafj profile image
Ahmad Rafsanjani

Aah..got it.. thanx

Forem Open with the Forem app