2019-03-14 Daily Challenge

What I've done today is Moving Zeros To The End in JavaScript.

CodeWars

Problem

Moving Zeros To The End

Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.

moveZeros([false,1,0,1,2,0,1,3,"a"]) // returns[false,1,1,2,1,3,"a",0,0]

Solution

var moveZeros = function (arr) {
  return arr.filter(a=>a!==0).concat(arr.filter(a=>a===0))
}