
Wes Bos @wesbos
🔥 Use the modulus operator in JavaScript to find out if a number has a decimal. You can then use that in Intl.NumberFormat to trim off .00 when displaying prices of whole dollar amounts https://t.co/t59fXDJrAD
Wes Bos @wesbos
🔥 Use the modulus operator in JavaScript to find out if a number has a decimal. You can then use that in Intl.NumberFormat to trim off .00 when displaying prices of whole dollar amounts https://t.co/t59fXDJrAD
Marc Backes ⚡️ @themarcba
Pro tip™ - When working with big numbers in JavaScript, you can use _ to visually separate the digits. https://t.co/0aUe8xyz5k
Simon Høiberg @SimonHoiberg
If you've been working with the AWS SDK for Node.js, you probably know that the DynamoDB client returns entries in a quite annoying format. Use this utility function to unwrap it into a normal-shaped object. 👉 https://t.co/uou6cBvO9d https://t.co/Jub2m8kb4p
Simon Høiberg @SimonHoiberg
Deep Freeze an object. If you enjoy working with immutable JavaScript, this utility function is really handy. 👉 https://t.co/Bp68tjlV2V https://t.co/xwA7UBxdwl
Simon Høiberg @SimonHoiberg
Create a deep clone of an object. It does exactly what you would expect - creating a copy of an object, without any pointers to the original object. 👉 https://t.co/rMUiyKrKbi https://t.co/f2G9pG8hLH
Simon Høiberg @SimonHoiberg
Get the last item of either an Array, Set, Map or object. Great for quickly accessing the last item dynamically without having to make any transformation. 👉 https://t.co/oOU2wi2uAD https://t.co/UxTpsrzxLo
Simon Høiberg @SimonHoiberg
Generate a number range. It's one of the cool inbuilt utility functions in Python, but unfortunately, we're missing this in JavaScript. 👉 https://t.co/qKAhCwzj4m https://t.co/q9h53ZVrbE
Simon Høiberg @SimonHoiberg
Generate a random number in a range. If you need to generate a random number between a minimum and maximum value. 👉 https://t.co/qNvV6KLvey https://t.co/js98B0kST6
Simon Høiberg @SimonHoiberg
Create a unique string. Great for quickly creating unique IDs. 👉https://t.co/PxZm9xdfuW https://t.co/xP5e2hg0fM
Marko ⚡ Denic @denicmarko
JavaScript tip: Convert a string to a number: https://t.co/nLhW9RdxFs
FrontEnd Dude 👨💻 @frontenddude
🔥 Have you heard of the 'onbeforeunload' event? When a user clicks back, you can use onbeforeunload to prompt the user. Returning a value will change the default message in the popup. Great for sites that handle a lot of data input! #100daysofcode #CodeNewbies #javascript #js https://t.co/a9r597cys7
Shannon Moeller @shannonmoeller
JavaScript has a native solution to natural sort! https://t.co/CJfRZ3r9tL https://t.co/B6ve81r7G7 @codepen https://t.co/BoCCsR2QJ8
Minko Gechev @mgechev
JavaScript tip: use labels to break from nested loops https://t.co/nNPFkjZFt5
Minko Gechev @mgechev
Quick cheatsheet for finding the intersection, union, difference, and the symmetric difference of two JavaScript arrays. https://t.co/K49RucrI5T
Telmo @telmo
🔥 Get rid of duplicate values in #JavaScript Use spread operator together with new set to get rid of duplicate values. https://t.co/QxIgIiOcii
Eddy Vinck 👨💻 JavaScript @Veinq_
Did you know about Navigator.vibrate() ? Twitter uses it on their website to make your phone vibrate when you like a tweet. I recommend liking this tweet to try it 👉♥️ 😁 #100DaysOfCode https://t.co/1dbFveu1O2
Minko Gechev @mgechev
JavaScript tip: did you know you can listen for a *single occurrence* of an event using addEventListener? You can specify a configuration object as a third parameter. https://t.co/R0JwOMueVi
Umar Hansa @umaar
Little JavaScript snippet to see what all those .toThing() methods do on a Date object: Object.getOwnPropertyNames(Date.prototype) .filter(name => name.startsWith('to')) .map(method => `${method}: ${(new Date())[method]()}`) https://t.co/3H8XcZbgja
Wes Bos @wesbos
🔥 Free up hard drive space and delete node_modules folders Run `npx npkill` https://t.co/m8tJJnvmw2
Wes Bos @wesbos
🔥Default function arguments can fallback to a function. This won't be run at definition time, but only once the function is called and no argument is provided. In this case, Math.random() returns a new random number each time https://t.co/xtrn822CEN