If you want to filter out trailing full-stops/periods at the regex level and not rely on Number() to remove them, you could use something like the following: *let reg = /\d+(\.\d+)?/g;* Which is essentially saying, only include the decimal point if there is at least one digit after it.
@_chris_67864 жыл бұрын
Great solution. Thank you for teaching us!
@Hakeem-rk4ns4 жыл бұрын
You are the best ❤❤
@withgrowinginsanity1984 жыл бұрын
Formatted amounts are tricky :) e.g. 12.489,56 (p.s. Thank you for turning my pure hatred towards JavaScript into tolerance :D )
@arunkaiser4 жыл бұрын
Always Awesome 👌
@EitanPeles4 жыл бұрын
great!
@rajeshsahu30734 жыл бұрын
Nice video..
@mikaelkortbaoui87852 жыл бұрын
let reg = /\d+\,*\d*/g; for some reason doesn't work, it just print's out NAN
@AllThingsJavaScript2 жыл бұрын
Please supply more of you code. A regular expression shouldn't produce NaN. It must be happening after, so curious what the rest of your code looks like.