Total 149 Posts

How to Split a String in JavaScript

Introduction

JavaScript has a lot of useful built-in methods for string manipulation, one of these method is the split() method.

In this article we'll be taking a closer look at the split() method and how we can use it in conjunction with regular expressions to split a long string just

JavaScript: Check if String Starts with Substring

Introduction

In this tutorial, we'll take a look at how to check if a string starts with a substring in JavaScript.

This is easily achieved either through the startsWith() method, or regular expressions.

Check if String Starts with Another String with startsWith()

The startsWith(searchString[, position]) method returns a boolean

JavaScript: Get Number of Days Between Dates

Introduction

We oftentimes find ourselves counting the number of days from and to a date. Be it calculating when someone's due to return a book, when a subscription should be renewed, how many days have passed since a notification or when a new event is coming up.

In this tutorial,

How to Split an Array Into Even Chunks in JavaScript

Introduction

Arrays are one the most used structures in JavaScript programming, which is why it's important to know its built-in methods like the back of your pocket.

In this tutorial, we'll take a look at how to split an array into chunks of n size in JavaScript.

Specifically, we'll take

Merge Properties of Two Objects Dynamically in JavaScript

Introduction

In JavaScript, an object is defined as a collection of key-value pairs. An object is also a non-primitive data type.

You'll oftentimes need to combine objects into a single one which contains all the individual properties of its constituent parts. This operation is called merging. The two most common

How to Format Number as Currency String in JavaScript

Introduction

Having to manually format a number as a currency string can be a tedious process. Even though this can be done oftentimes in a few lines of code, it's good practice to follow a standardized norm rather than hardcode it yourself, plus it's way easier for the developer writing

Compare Two Dates in JavaScript

Introduction

Dates are a really common data type developers work with. From timestamps of certain actions, to reports, sign up features and limited-time access in systems that require subscriptions - we oftentimes have to compare dates.

That is, we compare if a date is after or before another, if the

Form Data Validation in Node.js with express-validator

Introduction

It is imperative to carry out server-side validation when building applications - especially client-facing applications. The reason being, one can never rely on the user’s input alone; as these inputs sometimes contain bogus/malicious data.

Client-side validation is a great way to sift through most of the input,