How to find duplicates in an array JavaScript

In this article, let’s look at the different ways to find duplicates in an array in JavaScript. We’re going to be looking at different pre-defined JavaScript methods and finally some manual methods of finding the duplicates (usually using loops). We’ll be looking at: 1. Finding if an array contains duplicates. 2. Getting an array of … Read more

How to truncate a string in JavaScript

In this tutorial, let’s look at how to truncate a string in JavaScript. We’re going to be looking at using the ‘slice’, ‘splice’, ‘split’ and other pre-defined functions in JavaScript, as well as manual methods using the ‘for’ loop. Let’s get to it then! Check if the string is already within the limit Before we … Read more