Skip to content

Instantly share code, notes, and snippets.

@JamieDixon
Created April 8, 2014 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamieDixon/10139872 to your computer and use it in GitHub Desktop.
Save JamieDixon/10139872 to your computer and use it in GitHub Desktop.
var moveZeros = function (arr) {
var zeros = [];
var foo = arr.filter(function(value) {
var isZero = value === 0;
if(isZero) { zeros.push(0); }
return value !== 0;
})
return foo.concat(zeros);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment