JavaScript tips you won't see in most tutorials.
🧵
1. "Go back" button
Use the `history.back()` to create a “Go Back” button.
2. Numbers separators
To improve readability for numbers, you can use underscores as separators:
3. Run event listener only once
If you want to add an event listener but have it run only once, you can use the ` once` option:
4. You can wrap your console.log() arguments with curly brackets to see the variable names.
5. Get min/max value from an array
You can use `Math.min()` or `Math.max()` combined with the spread operator to find the minimum or maximum value in an array.
6. Copy to clipboard
You can use the `Clipboard` API to create the “Copy to clipboard” functionality:
If you liked this thread, maybe you'd love to bookmark it as a post.
P.S. You can find a few more tips there.
markodenic.com/javascript-tip…
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.