DEV Community

Discussion on: Leetcode - Move Zeros (with JavaScript)

Collapse
 
kamo profile image
KAIDI

Loop
If zero found slice it then push it at the end
for( const n of arr)
If n==0
arr.slice(n)
arr.push(0)