Motivation
Most of the programming languages are open enough to allow programmers to do things multiple ways for a similar outcome. Java...
For further actions, you may consider blocking this person and/or reporting abuse
hey, awesome article. just a small correction
because of the null coalescing, if
person.age === 0
, the variableage
is0
.Big thank for helping me to correct the typo.
Hadn't seen the
isRequired
idea before! Clever list :)Thanks Elliot!
Number.isInteger
method was designed to be used with numbers in order to test if it is an integer or not (NaN, Infinity, float...).developer.mozilla.org/en-US/docs/W...
Using
typeof mynum === "number"
is a better solution to test if a value is a number.Note, that the Number rounding of floats in JavaScript is not accurate
Since this rounding affects integer representation, too, you should also consider
Number.isSafeInteger
developer.mozilla.org/en-US/docs/W...
Also please consider Integer boundaries in JS, that are represented by
Number.MAX_SAFE_INTEGER
andNumber.MIN_SAFE_INTEGER
developer.mozilla.org/en-US/docs/W...
developer.mozilla.org/en-US/docs/W...
Edit: sry wanted to post on top level, somehow ended up as comment on yours
Awesome, thanks Jan!
I thought I would know everything in this list, but learned something new!!! Didn't know about the nullish coalescing operator, pretty useful! Thank you Tapas
Thanks, Oscar!
It's quite new, so it won't work everywhere yet.
?? operator not working for me. shows as below
SyntaxError: Unexpected token '?'
Which browser are you using? It should work.
Output, Age of Jack is 35
Also, check if there is a syntax error. You can paste the code as a comment.
Points 3,8,9 blew my mind away. Especially the user of a function to throw errors 🙏👏👏
Great.. Thanks, Venkatesh!
Really nice tricks to know. Nice work keep this good work going...
Good health
Thanks Sakar for the encouragements!
Awesome, thanks for sharing!
Thanks for reading and commenting!
Good tricks shared in this article I learnt some new also
Thanks Fahad!
I have used window.location.hash in pages where tab content need to be loaded initially based on url hash. I find this pretty useful
Cool, thanks for sharing Niroj!