Skip to content

Commit 675b03d

Browse files
authored
Update js codes.docx
1 parent 6dc6d38 commit 675b03d

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

js codes.docx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,9 +3371,36 @@ function hello(){
33713371
}
33723372
hello() //0 1 2 3
33733373
=========================================================================================================================================================================
3374+
//move zeroes
33743375

3376+
function moveZeroes(arr){
3377+
for(let i=0; i<arr.length; i++){
3378+
if(arr[i] === 0){
3379+
arr.push(0);
3380+
arr.splice(i,1)
3381+
}
3382+
}
3383+
return arr
3384+
}
3385+
console.log(moveZeroes([0,2,3,0,50,0,3,0,8,2,0]))
3386+
=======================================================================================================================================================================
33753387

33763388

3389+
=======================================================================================================================================================================
3390+
3391+
=======================================================================================================================================================================
3392+
3393+
=======================================================================================================================================================================
3394+
3395+
=======================================================================================================================================================================
3396+
3397+
=======================================================================================================================================================================
3398+
3399+
=======================================================================================================================================================================
3400+
3401+
=======================================================================================================================================================================
3402+
3403+
=======================================================================================================================================================================
33773404

33783405

33793406

0 commit comments

Comments
 (0)