+ 1
JS Is there a sorter version of this code?
Is there a shorter version of this code? im looking for one. removeZeros=a=>a.join("").replace(/^0+|0+$/g,'').split("").map(Number); for the result, look at : https://code.sololearn.com/W6mE4bD9tTwM/
1 Answer
+ 1
I want to remove the leading and trailling zero in a array
removeZeros([0, 9, 5, 0, 0, 0, 0, 2, 0, 0]) should return [9, 5, 0, 0, 0, 0, 2] not [9, 5, 2]