Hari Krishna Anemforharikrishna.hashnode.net·Nov 25, 2022Move 0's in the front and non-zeroes at the endconst numbers = [1, 0, 3, 4, 0, 0, 5, true, "js", 2, 0, 7, 0, 9, false, 0]; function moveAllZeroesToFront () { return [...numbers.filter(item => !item && Number(item) === item), ...numbers.filter(item => item !== 0)]; } const arr = moveAllZeroes...Discussmove
Hari Krishna Anemforharikrishna.hashnode.net·Nov 25, 2022Move 0's in the front and non-zeroes at the endconst numbers = [1, 0, 3, 4, 0, 0, 5, true, "js", 2, 0, 7, 0, 9, false, 0]; function moveAllZeroesToFront () { return [...numbers.filter(item => !item && Number(item) === item), ...numbers.filter(item => item !== 0)]; } const arr = moveAllZeroes...Discussmove