Tapas Adhikary
Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source
Motivation Most of the programming languages are open enough to allow programmers to do things multiple ways for a similar outcome. JavaScript is in no way different. With JavaScript, we often find multiple ways of doing things for a similar outcome,...
blog.greenroots.info15 min read
Tapas Adhikary
Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source
The default value example isn't the best.. If Jack has just been born he's suddenly 35
I think that the output is incorrect of the bullet number 11: let [fruit, ...rest] = emojis; console.log(rest);
Cool collection of JS tricks
I like the isRequired trick as it is simply claver and very useful.
Good job Tapas
Great list - lots of lovely little tidbits, especially the isRequired helper function. Love that!
You have to be slightly careful with the default or in 5, though. If age is 0, it will overwrite it (making your new born person object a 35 year old π).
A safer, albeit slightly less-well-supported (IE doesn't know about it), way of attacking it is to use the nullish coalescing operator - ?? which returns truthy values such as 0.
More info available on MDN: developer.mozilla.org/en-US/docs/Web/JavaScript/Rβ¦
I'm not sure about the random function, because of the rounding. Check it out: I believe that the min and max values aren't produced as often the other ones.
Amazing tricks! Thanks for sharing π€ π
Another legendary article born from Mr. Tapas Adhikary's fingers! Thanks!
Whoa! This post is a Treasure π₯ Thanks for sharing π§‘
Wow! Such a wonderful list. We should pin it somewhere and force every JavaScript developer to go through this. π
event.target.valueAsNumber: I never knew about this neat trick! Learned something new!
I also found isRequired check very clever.
Thanks for writing this article. It's a treausure. π
This is really amazing, thanks for sharing!
Shubham Kumar
frontEnd Devloper!! 'Focous' is the New IQ
Wow, this is awesome, Thank you so much for sharing this