Written in 2020 ⏳
Dec
Convert decimal to binary recursively
11 Dec, 2020
Create cartesian product
02 Dec, 2020
Oct
<> vs React.Fragment
07 Oct, 2020
Sep
encodeURI vs encodeURIComponent
10 Sep, 2020
word-break: break-all vs word-wrap: break-word
09 Sep, 2020
for ... in vs for ... of
08 Sep, 2020
margin vs padding
04 Sep, 2020
<div> vs <section>
04 Sep, 2020
arrow vs regular function
04 Sep, 2020
function declaration vs function expression
03 Sep, 2020
border-box vs content-box
03 Sep, 2020
clientY vs pageY
01 Sep, 2020
Aug
script async vs script defer
31 Aug, 2020
Map vs WeakMap
27 Aug, 2020
event bubbling vs capturing
27 Aug, 2020
const enum vs enum
27 Aug, 2020
literal union type vs string enums
26 Aug, 2020
string vs String
25 Aug, 2020
concat vs push
25 Aug, 2020
interface vs type
20 Aug, 2020
*.d.ts vs *.ts
20 Aug, 2020
const vs readonly
20 Aug, 2020
function vs property in interface
18 Aug, 2020
Object vs Map
10 Aug, 2020
Generate a random IP address
10 Aug, 2020
Truncate a number at decimal
05 Aug, 2020
Get the number of a character in a string
02 Aug, 2020
Convert a letter to associate emoji
02 Aug, 2020
slice vs splice
01 Aug, 2020
Jul
Calculate the number of months between two dates
27 Jul, 2020
display: none vs [hidden]
18 Jul, 2020
undefined vs void
16 Jul, 2020
substr vs substring
15 Jul, 2020
++value vs value++
15 Jul, 2020
method in class constructor vs prototype
15 Jul, 2020
Box handler
15 Jul, 2020
hasOwnProperty vs in
08 Jul, 2020
style="width: ___" vs width="___"
02 Jul, 2020
Jun
naturalWidth vs width
30 Jun, 2020
clientHeight vs offsetHeight vs scrollHeight
28 Jun, 2020
Convert cookie to object
27 Jun, 2020
DOMContentLoaded vs load
25 Jun, 2020
stopImmediatePropagation vs stopPropagation
24 Jun, 2020
instanceof vs typeof
24 Jun, 2020
event.preventDefault vs return false
24 Jun, 2020
currentTarget vs target
24 Jun, 2020
Check if an array is empty
23 Jun, 2020
Get the base URL without any parameters
20 Jun, 2020
<button> vs <input type="button" />
19 Jun, 2020
<b>, <i> vs <strong>, <em>
19 Jun, 2020
null vs undefined
18 Jun, 2020
mouseenter vs mouseover
18 Jun, 2020
keydown vs keypress vs keyup
18 Jun, 2020
double quotes vs single quote
18 Jun, 2020
const vs let vs var
18 Jun, 2020
border vs outline
17 Jun, 2020
nodeName vs tagName
16 Jun, 2020
key vs keyCode vs which
16 Jun, 2020
Count by the properties of an array of objects
14 Jun, 2020
Get the first defined and non null argument
12 Jun, 2020
Count the occurrences of array elements
11 Jun, 2020
Count the occurrences of a value in an array
11 Jun, 2020
string.charAt(i) vs string[i]
10 Jun, 2020
object.property vs object["property"]
10 Jun, 2020
Object.getOwnPropertyNames() vs Object.keys()
10 Jun, 2020
Number() vs parseInt()
10 Jun, 2020
delete obj.property vs obj.property = undefined
10 Jun, 2020
Check if a string is a hexadecimal number
10 Jun, 2020
Check if a string is a hexadecimal color
09 Jun, 2020
Check if a string contains only ASCII characters
09 Jun, 2020
Strip ANSI codes from a string
07 Jun, 2020
Check if a string contains only letters
07 Jun, 2020
Check if a value is a string
05 Jun, 2020
Trim some character
04 Jun, 2020
Check if a number is in a given range
04 Jun, 2020
Group an array of objects by a key
03 Jun, 2020
Object.is() vs ===
02 Jun, 2020
== vs ===
02 Jun, 2020
array = [] vs array.length = 0
02 Jun, 2020
argument vs parameter
02 Jun, 2020
apply vs call
02 Jun, 2020
May
Redirect the page to HTTPS if it is in HTTP
31 May, 2020
Trim the file extension from a file name
30 May, 2020
Unescape HTML special characters
29 May, 2020
Truncate a string at full words
29 May, 2020
Escape HTML special characters
29 May, 2020
Get the value of a cookie
28 May, 2020
Convert a number to equivalent characters
27 May, 2020
Convert the name of an Excel column to number
25 May, 2020
class vs id
24 May, 2020
alt vs title
24 May, 2020
addEventListener() function vs on property
24 May, 2020
Swap the rows and columns of a matrix
24 May, 2020
parentElement vs parentNode
23 May, 2020
Normalize vs Reset CSS
23 May, 2020
Element vs Node
23 May, 2020
:active vs :focus
23 May, 2020
Decode a JWT token
23 May, 2020
Find the closest number from an array
22 May, 2020
Get the yesterday date
21 May, 2020
Get the tomorrow date
21 May, 2020
Sort an array of numbers
20 May, 2020
Shuffle an array
20 May, 2020
Check if multiple objects are equal
20 May, 2020
Calculate the factorial of a number
19 May, 2020
Create an object from the pairs of key and value
18 May, 2020
Check if a string is a palindrome
18 May, 2020
Round a number to a given number of digits
16 May, 2020
Memoize a function
16 May, 2020
Get the length of a string in bytes
16 May, 2020
Get the day of the year from a date
16 May, 2020
Get the arrays of digits from a number
16 May, 2020
Convert degrees to radians
16 May, 2020
Convert a string to camelCase
16 May, 2020
Check if a string contains upper case characters
16 May, 2020
Check if a string contains lower case characters
16 May, 2020
Calculate Fibonacci numbers
16 May, 2020
Add an ordinal suffix to a number
16 May, 2020
Unzip an array of arrays
15 May, 2020
Uncurry a function
15 May, 2020
Normalize file path slashes
15 May, 2020
Invert keys and values of an object
15 May, 2020
Curry a function
15 May, 2020
Convert seconds to hh:mm:ss format
15 May, 2020
Convert a Windows file path to Unix path
15 May, 2020
Convert a string to PascalCase
15 May, 2020
Check if a value is an async function
15 May, 2020
Check if a value is a generator function
15 May, 2020
Check if a value is a function
15 May, 2020
Check if a URL is absolute
15 May, 2020
Check if a path is relative
15 May, 2020
Check if a value is a regular expression
14 May, 2020
Zip multiple arrays
13 May, 2020
Split an array into chunks
13 May, 2020
Shallow copy an object
13 May, 2020
Pick a subset of properties of an object
13 May, 2020
Partition an array based on a condition
13 May, 2020
Partially apply a function
13 May, 2020
Omit a subset of properties from an object
13 May, 2020
Logical xor operator
13 May, 2020
Get the value at given path of an object
13 May, 2020
Execute a function once
13 May, 2020
Check if a value is an object
13 May, 2020
Check if a value is a plain object
13 May, 2020
Flip the arguments of a function
12 May, 2020
Delay the evaluation of a function
12 May, 2020
Convert snake_case to camelCase
12 May, 2020
Convert camelCase to kebab-case and vice versa
12 May, 2020
Compose functions from left to right
12 May, 2020
Compare two arrays regardless of order
11 May, 2020
Check if an array is subset of other array
10 May, 2020
Replace multiple spaces with a single space
09 May, 2020
Remove falsy values from array
09 May, 2020
Get union of arrays
09 May, 2020
Get the intersection of arrays
09 May, 2020
Detect Internet Explorer browser
09 May, 2020
Convert Celsius to Fahrenheit
09 May, 2020
Check if a string contains only digits
09 May, 2020
Calculate the mod of collection index
08 May, 2020
Identity function
07 May, 2020
Create an empty function
07 May, 2020
Compose functions
07 May, 2020
Clone an array
07 May, 2020
Check if two strings are anagram
07 May, 2020
Check if a number is positive
07 May, 2020
Check if a number is negative
07 May, 2020
Wait for an amount of time
06 May, 2020
Format a date for the given locale
06 May, 2020
Check if an object is a Promise
06 May, 2020
Check if an array is not empty
06 May, 2020
Check if a value is nil
06 May, 2020
Check if a number is odd
06 May, 2020
Check if a number is even
06 May, 2020
Subtract arguments
05 May, 2020
Multiply arguments
05 May, 2020
Get the weekday of a date
05 May, 2020
Get the month name of a date
05 May, 2020
Generate a random UUID
05 May, 2020
Generate a random integer in given range
05 May, 2020
Generate a random boolean
05 May, 2020
Compare two arrays
05 May, 2020
Clamp a number between two values
05 May, 2020
Check if a date is today
05 May, 2020
Calculate the sum of arguments
05 May, 2020
Calculate the remainder of division of arguments
05 May, 2020
Calculate the division of arguments
05 May, 2020
Calculate the average of arguments
05 May, 2020
Convert an array of objects to a single object
04 May, 2020
Convert a string to URL slug
04 May, 2020
Detect the dark mode
03 May, 2020
Create a custom scrollbar
03 May, 2020
Check if the code is running in the browser
03 May, 2020
Validate a Gregorian date
03 May, 2020
Remove spaces from a string
03 May, 2020
Make the first character of a string lowercase
03 May, 2020
Encode a URL
03 May, 2020
Run Promises in sequence
02 May, 2020
Detect dark mode
02 May, 2020
Check if the code is running in the browser
02 May, 2020
Check if the code is running in NodeJS
02 May, 2020
Flatten an array
01 May, 2020
Emulate a dice throw
01 May, 2020
Apr
Scroll to an element smoothly
26 Apr, 2020
Detect mobile browsers
25 Apr, 2020
Check if the touch events are supported
25 Apr, 2020
Easing functions
25 Apr, 2020
Check if the touch events are supported
25 Apr, 2020
Show or hide table columns
24 Apr, 2020
Get the direction of the text selection
24 Apr, 2020
Detect internet explorer browser
24 Apr, 2020
Attach event handlers inside other handlers
24 Apr, 2020
Prefix an integer with zeros
23 Apr, 2020
Get the value of a param from a URL
23 Apr, 2020
Generate a random string with given length
23 Apr, 2020
Generate a random string from given characters
23 Apr, 2020
Convert an array of strings to numbers
23 Apr, 2020
Check if a value is a number
23 Apr, 2020
Show a custom context menu at clicked position
21 Apr, 2020
Drag to scroll
20 Apr, 2020
Select the text content of an element
19 Apr, 2020
Save and restore the text selection
19 Apr, 2020
Get the selected text
19 Apr, 2020
Copy highlighted code to the clipboard
19 Apr, 2020
Toggle an element
19 Apr, 2020
Swap two variables
19 Apr, 2020
Strip HTML from a given text
19 Apr, 2020
Sort an array of dates
19 Apr, 2020
Show an element
19 Apr, 2020
Scroll to top of the page
19 Apr, 2020
Reverse a string
19 Apr, 2020
Replace an element
19 Apr, 2020
Replace all line breaks with br elements
19 Apr, 2020
Repeat a string
19 Apr, 2020
Reload the current page
19 Apr, 2020
Redirect to another page
19 Apr, 2020
Merge two arrays
19 Apr, 2020
Insert given HTML before an element
19 Apr, 2020
Insert given HTML after an element
19 Apr, 2020
Insert an element before other one
19 Apr, 2020
Insert an element after other one
19 Apr, 2020
Hide an element
19 Apr, 2020
Go back to the previous page
19 Apr, 2020
Get the unique values of an array
19 Apr, 2020
Get the sum of an array of numbers
19 Apr, 2020
Get the selected text
19 Apr, 2020
Get the rank of an array of numbers
19 Apr, 2020
Get the number of days in given month
19 Apr, 2020
Get the file name from a URL
19 Apr, 2020
Get the file extension from a file name
19 Apr, 2020
Get the current timestamp in seconds
19 Apr, 2020
Get the average of an array
19 Apr, 2020
Get all siblings of an element
19 Apr, 2020
Get a random item from an array
19 Apr, 2020
Generate a random hex color
19 Apr, 2020
Find the minimum item of an array
19 Apr, 2020
Find the maximum item of an array
19 Apr, 2020
Empty an array
19 Apr, 2020
Detect macOS browser
19 Apr, 2020
Create an array of numbers in the given range
19 Apr, 2020
Create an array of cumulative sum
19 Apr, 2020
Convert rgb color to hex
19 Apr, 2020
Convert hex to rgb
19 Apr, 2020
Convert a string to number
19 Apr, 2020
Convert a date to YYYY-MM-DD format
19 Apr, 2020
Compare two dates
19 Apr, 2020
Check if an object is empty
19 Apr, 2020
Check if an object is an array
19 Apr, 2020
Check if an element is focused
19 Apr, 2020
Check if an element is a descendant of another
19 Apr, 2020
Check if all items in an array are equal
19 Apr, 2020
Check if a year is leap year
19 Apr, 2020
Check if a string is upper case
19 Apr, 2020
Check if a string is lower case
19 Apr, 2020
Check if a string contains whitespace
19 Apr, 2020
Check if a number is a power of 2
19 Apr, 2020
Check if a given integer is a prime number
19 Apr, 2020
Check if a date is between two dates
19 Apr, 2020
Zoom an image
18 Apr, 2020
Prevent body from scrolling when opening a modal
18 Apr, 2020
Scroll to an element
08 Apr, 2020
Print an image
08 Apr, 2020
Create a range slider
07 Apr, 2020
Create an image comparison slider
06 Apr, 2020
Create resizable split views
04 Apr, 2020
Drag and drop table column
03 Apr, 2020
Drag and drop table row
02 Apr, 2020
Press Shift and Enter for a new line
01 Apr, 2020
Drag and drop element in a list
01 Apr, 2020
Distinguish between left and right mouse clicks
01 Apr, 2020
Mar
Show a ghost element when dragging an element
31 Mar, 2020
Allow to enter particular characters only
31 Mar, 2020
Check if an element is in the viewport
28 Mar, 2020
Paste as plain text
19 Mar, 2020
Swap two nodes
18 Mar, 2020
Paste an image from the clipboard
18 Mar, 2020
Count the number of characters of a textarea
18 Mar, 2020
Upload files with Ajax
17 Mar, 2020
Submit a form with Ajax
17 Mar, 2020
Serialize form data into a query string
17 Mar, 2020
Export a table to csv
17 Mar, 2020
Scale a text to fit inside of an element
16 Mar, 2020
Insert given HTML after or before an element
16 Mar, 2020
Resize an image
15 Mar, 2020
Detect mac OS browser
15 Mar, 2020
Strip HTML from a given text
10 Mar, 2020
Prevent the default action of an event
10 Mar, 2020
Get size of the selected file
10 Mar, 2020
Check if the native date input is supported
10 Mar, 2020
Detect if an element is focused
09 Mar, 2020
Sort a table by clicking its headers
08 Mar, 2020
Resize columns of a table
05 Mar, 2020
Placeholder for a contenteditable element
04 Mar, 2020
Make a resizable element
03 Mar, 2020
Make a draggable element
03 Mar, 2020
Determine the height and width of an element
03 Mar, 2020
Detect if the caps lock is on
03 Mar, 2020
Calculate the size of scrollbar
03 Mar, 2020
Feb
Toggle password visibility
28 Feb, 2020
Toggle an element
28 Feb, 2020
Put cursor at the end of an input
28 Feb, 2020
Measure the width of given text of given font
28 Feb, 2020
Get the default value of a CSS property
28 Feb, 2020
Change the website favicon
28 Feb, 2020
Select the text of a textarea automatically
27 Feb, 2020
Get the first scrollable parent of an element
27 Feb, 2020
Check if an element is scrollable
27 Feb, 2020
Create one time event handler
24 Feb, 2020
Copy text to the clipboard
24 Feb, 2020
Check if an element is a descendant of another
22 Feb, 2020
Resize an iframe to fit its content
21 Feb, 2020
Replace broken images
21 Feb, 2020
Redirect to another page
21 Feb, 2020
Preview an image before uploading it
21 Feb, 2020
Go back to the previous page
21 Feb, 2020
Get the size of an image
21 Feb, 2020
Get or set the document title
21 Feb, 2020
Download a file
21 Feb, 2020
Scroll to top of the page
18 Feb, 2020
Reload the current page
18 Feb, 2020
Prepend to an element
18 Feb, 2020
Load a JavaScript file dynamically
18 Feb, 2020
Load a CSS file dynamically
18 Feb, 2020
Get the document height and width
18 Feb, 2020
Detect clicks outside of an element
18 Feb, 2020
Trigger an event
17 Feb, 2020
Show or hide an element
17 Feb, 2020
Set CSS style for an element
17 Feb, 2020
Get siblings of an element
17 Feb, 2020
Get, set and remove data attributes
17 Feb, 2020
Get, set and remove attributes
17 Feb, 2020
Get or set the HTML of an element
17 Feb, 2020
Get CSS styles of an element
17 Feb, 2020
Attach or detach an event handler
17 Feb, 2020
Append to an element
17 Feb, 2020
Wrap an element around a given element
16 Feb, 2020
Unwrap an element
16 Feb, 2020
Select the children of an element
16 Feb, 2020
Select an element or list of elements
16 Feb, 2020
Replace an element
16 Feb, 2020
Remove an element
16 Feb, 2020
Remove all children of a node
16 Feb, 2020
Loop over a nodelist
16 Feb, 2020
Insert an element after or before other element
16 Feb, 2020
Get the text content of an element
16 Feb, 2020
Get the parent node of an element
16 Feb, 2020
Get the closest element by given selector
16 Feb, 2020
Execute code when the document is ready
16 Feb, 2020
Create an element
16 Feb, 2020
Clone an element
16 Feb, 2020
Check if an element has given class
16 Feb, 2020
Check an element against a selector
16 Feb, 2020
Add or remove class from an element
16 Feb, 2020
Jan
Triangle buttons
21 Jan, 2020
Arrow buttons
21 Jan, 2020
Watermark
18 Jan, 2020
Full background
18 Jan, 2020
Lined paper
17 Jan, 2020
Curved background
17 Jan, 2020
Stamp border
16 Jan, 2020
Nested dropdowns
13 Jan, 2020
Status light
12 Jan, 2020
Fading long section
10 Jan, 2020
Newsletter 🔔
If you're into front-end technologies and you want to see more of the content I'm creating, then you might want to consider subscribing to my newsletter.
By subscribing, you'll be the first to know about new articles, products, and exclusive promotions.
Don't worry, I won't spam you. And if you ever change your mind, you can unsubscribe at any time.
Phước Nguyễn