We can scroll to given element smoothly (smooth scroll) by passing behavior: ‘smooth’.
Convert a string to a number
Sometimes it returns integer. Other times it returns a float. And if you pass in a string with random text in it, you’ll get NaN, an acronym for Not a Number.
Check if array has duplicates
Checks if there are duplicate values in a flat array. Use Set to get the unique values in the array.
Make a resizable element
First, we need to prepare some elements that indicate the element is resizable. They are placed absolutely at the four sides of the original element.
Convert a string into an integer (a whole number)
Convert a string into an integer (a whole number).
Remove a class from HTML element
Use Element.classList and DOMTokenList.remove() to remove the specified class from the element.
Make a draggable element
In order to make an element draggable, we need to handle three events.
Template Literals
Template literals provide a simpler way to create strings that span multiple lines or contain data.
Looping over an object’s keys and values
In this example you have access to each pair using the key and value variables during the loop.
Take a number and return it in the specified currency formatting
Use Intl.NumberFormat to enable country / currency sensitive formatting.