How to Validate URLs in JavaScript

A Uniform Resource Locator (URL) is what leads you to a page or file on the internet. URLs serve as the addresses of things on the internet. All valid URLs follow certain patterns. So if you know those patterns, you can determine whether a URL is valid or not in

Read More

How to Check if an Object is Empty in JavaScript – JS Java isEmpty Equivalent

An object is one of the most commonly used data types in programming. An object is a collection of related data stored as key-value pairs. For example: let userDetails = { name: “John Doe”, username: “jonnydoe”, age: 14, } When working with objects, you

Read More

How to Merge Arrays in JavaScript – Array Concatenation in JS

There are multiple ways to merge arrays in JavaScript. You can use long or short approaches. I’ll be showing 3 of them in this article. When working with arrays in JavaScript, there are cases where you want to combine multiple arrays together. For example, arrays with related data coming from

Read More

How to Reverse an Array in JavaScript – JS .reverse() Function

In this article, I’ll show you two ways to reverse arrays in JavaScript. The reverse method of arrays reverses an array by making the last item the first, and making the first item the last. The other items in between also get reversed, respectively. Before showing you examples of the

Read More

JS Check for Null – Null Checking in JavaScript Explained

Null is a primitive type in JavaScript. This means you are supposed to be able to check if a variable is null with the typeof() method. But unfortunately, this returns “object” because of an historical bug [https://www.turbinelabs.com/blog/the-odd-history-of-javascripts-null] that cannot be fixed. let userName = null; console.log(typeof(userName)); // object So how

Read More

How to Build a RESTful API with AdonisJS

As a developer, it’s important to understand how APIs work. APIs have helped bridged the gap between the frontend and backend. They also let you separate parts of large codebases and take advantage of a microservices architecture. This separation of concerns makes learning and building RESTful APIs an in-demand skill

Read More

How to Work with Strings in JavaScript – Tips for Efficient String Concatenation

Everything you see in browser – except images and videos – is a string. That’s why you should learn how to work with them properly. This will dramatically increase the performance of your web applications, both on the frontend and backend. How Default String Concatenation Works – and Its

Read More

JavaScript String to Boolean – How to Parse a Boolean in JS

When you’re manipulating data, receiving values from forms, and dealing with data in other ways, these values may take the incorrect datatype. Assume you want your value to be a boolean with either true or false, but it is stored as a string – “true” or “false.” It becomes challenging

Read More