JavaScript: Count the occurrences of each word in a string
The example below shows you how to count the occurrences of each word in a given sentence in Javascript. The result will be an object where each key…
[JS] Generate a random number between Min and Max and exclude a specific number
Creating a random number is popular stuff in Javascript that has many use cases. This article shows you how to generate a random number between a minimum number…
JavaScript: Get current date time in yyyy/MM/dd HH:mm:ss format
This concise article shows you how to get the current date and time in Javascript in yyyy/MM/dd HH:mm:ss format. We’ll write code from scratch without using any third-party…
How to Subtract and Compare 2 Dates in JavaScript
This article is about subtracting and comparing 2 dates in Javascript. We’ll have a look at the fundamentals and then walk through several examples of applying that knowledge…
JavaScript: Check if a string contains a substring (4 approaches)
This practical article walks you through 4 different ways to check whether a given string contains a substring or not. Without any further ado (like talking about the…
JavaScript: Convert timestamp to date time and vice versa
This article shows you how to convert Unix timestamp into date time and vice versa in Javascript. Overview Unix timestamp is a numeric value that represents the number…
JavaScript: How to Convert Date Time to Time Ago
Time ago is the concept of expressing a time relative to the current time. For example, if it is currently 3 pm and we want to talk about…
JavaScript: 3 Ways to Remove a Property from an Object
When working with Javascript, there might be cases where it becomes necessary to remove single or multiple properties from a given object. For example, if you are creating…
How to Remove Elements from an Array in JavaScript
As a programmer, there might be scenarios where you have to remove specific elements from an array in Javascript. It is important to understand the various techniques available…
JavaScript: Convert UTC time to local time and vice versa
It is essential for web applications to display the correct time, especially when dealing with multiple time zones. This is where converting between UTC and local time comes…