JavaScript

JavaScript Array.with() method (with examples)

Updated: September 6, 2023 By: Khue

This concise, straightforward article is dedicated to the Array.with() method in modern JavaScript. Overview The Array.with() method was added to the programming language in ECMAScript 2021, which is…

JavaScript: Get the user’s preferred language

Updated: August 5, 2023 By: Khue

This concise, straightforward article shows you how to detect the user’s preferred language in their web browser by using the built-in features of modern JavaScript. What is the…

JavaScript: Check if a Year is a Leap Year (2 Ways)

Updated: August 5, 2023 By: Khue

Leap years are years with an extra day, February 29, to keep the calendar year synchronized with Earth’s orbit around the sun. They occur every four years, except…

JavaScript: Convert a string to Unicode code points (2 ways)

Updated: August 5, 2023 By: Khue

Unicode code points are the numerical values that represent each character in the Unicode standard, which covers over a million characters from various languages, scripts, symbols, and emojis….

JavaScript: Remove Multiple Consecutive White Spaces

Updated: June 17, 2023 By: Wolf

When working with text data in JavaScript, there might be cases where you encounter a string that contains multiple consecutive whitespace characters like this: The string above look…

JavaScript: Convert String to Hex and Vice Versa

Updated: June 17, 2023 By: Khue

A hex value (or a hexadecimal value) is a number that is represented in base 16, using digits from 0 to 9 and letters from A to F….

JavaScript: Convert Null, NaN, Undefined, and False to Zero

Updated: June 17, 2023 By: Wolf

When developing web applications, there might be cases you want to treat falsy values like null, NaN, undefined, and false as 0 (for instance, If you have variables…

JavaScript: Check if a string contains non-alphanumeric characters

Updated: June 17, 2023 By: Wolf

Non-alphanumeric characters refer to any character that is not a letter (A-Z, a-z) or a digit (0-9). Examples include symbols (!, @, #), punctuation marks (., ?, :),…

JavaScript: 2 Ways to Format a String with Leading Zeros

Updated: June 15, 2023 By: Khue

Padding strings with leading zeros ensures consistent formatting, proper sorting, and adherence to fixed-length requirements in numeric fields, data storage, and user interfaces. This pithy, example-based article walks…

JavaScript: Remove non-alphanumeric characters from a string

Updated: June 15, 2023 By: Khue

Non-alphanumeric characters in JavaScript are symbols and special characters that are not letters (a-z) or numbers (0-9). They include characters like @, #, $, %, and punctuation marks…

1 3 4 5 6 7 19