Always start by running through some examples to get a feel for the problem. With [1, 0, 2, 0, 4, 0], let's walk through the steps-- in this case, it may be best to work backwards.
We want to end up with [1, 2, 4, 0, 0, 0]. To do that, it seems like we need to separate out [1, 2, 4] and [0, 0, 0], so there's 3 things to consider.

xxxxxxxxxx48
var assert = require('assert');function zerosToEnd(nums) { // Fill in this method return nums;}console.log(zerosToEnd([1, 0, 2, 0, 4, 0]));try { assert.deepEqual(zerosToEnd([1, 0, 2, 0, 4, 0]), [1, 2, 4, 0, 0, 0]); console.log( 'PASSED: `zerosToEnd([1, 0, 2, 0, 4, 0])` should get us `[1, 2, 4, 0, 0, 0]`' );} catch (err) { console.log(err);}try { assert.deepEqual( zerosToEnd([4, 13, 0, 2, 0, 0, 15, 0]), [4, 13, 2, 15, 0, 0, 0, 0] ); console.log( 'PASSED: `zerosToEnd([4, 13, 0, 2, 0, 0, 15, 0])` should get us `[4, 13, 2, 15, 0, 0, 0, 0]`'OUTPUT
Results will appear here.