Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Moving Zeros To The End

///codewars : Moving Zeros To The End
function moveZeros(num) {
 let length = num.length;
    let x= num.filter((m)=>
m != 0 || !typeof m === "number" ||  typeof m === "boolean" || typeof m  ==='object'|| typeof m  ==='string'                     )
    let n=length-x.length;

    for(let i=0; i<n; i++){
        x.push(0)
    }
      return x ;
}
 
PREVIOUS NEXT
Tagged: #Moving #Zeros #To #The #End
ADD COMMENT
Topic
Name
9+8 =