Determining the sign of a number is super easy now with ES6's Math.sign ๐ It will indicate whether the number is positive, negative or zero.
co...
For further actions, you may consider blocking this person and/or reporting abuse
slight error:
Math.sign
either returns 1 or -1, so:did you perhaps mean
if (Math.sign(number) > 0)
? in which caseif (number > 0)
is more concise.OH good catch, let me fix it! Thanks for letting me know ๐ฑ
Its crazy to know, that even a positive / negative one line execution needs this much knowledge LoL
hahahaha ๐Tip of the iceberg...always more to know and more to learn when it comes to javascript ๐
Gotcha!
Laugh with sadness -- a perfect description of IE ๐ต
you always find a good topic, thank you
thank you! i just pick topics that i want to learn, luckily this one resonates with you ๐And if there is a topic you want me to cover, please let me know! ๐
Great content.
Thanks! Glad you liked the article ๐
+10 years with JavaScript and I never listen about negative 0! But make sense...
I only learned the negative 0 when i wrote this article. It will be interesting to see when i can actually apply it. I'll make sure to share when that happens ๐
Thanks for the article! Itโs always a good reminder that thereโs probably a built in JavaScript method for pretty much anything you wanna do! :)
Totally! JS is a big toolbox and continues to add more tools for us to use, which is awesome. Thanks for reading my article ๐
You learn something new everyday. Thanks for sharing!
I like that -- keep that student mindset so we can continue to learn and grow everyday! Thanks for reading ๐
Love your posts, Samantha, keep them coming
you bet! thanks for the encouragement benny ๐
Good to use !!