+ 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/

21st Dec 2017, 2:36 PM
Momo Belia
Momo Belia - avatar
1 Odpowiedź
+ 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]
22nd Dec 2017, 2:23 AM
Momo Belia
Momo Belia - avatar