JavaScript Reverse String – 4 Ways

In this tutorial I will talk about how you can reverse a string in JavaScript language. This is a very popular question i.e. asked in interviews. There are many ways in which we can reverse a string. Here I will discuss different ways in which we can achieve this. JavaScript Reverse String Using Buitin Function To reverse a string using built-in methods we have to chain some methods like join, split and reverse. For this first, we need to convert the string into an array by using split method then…

Read More

Reverse Lookups with JavaScript

I’ve always loved exploring regular expressions because they’re one of those skills that’s never taught in school — you need to pick them up on the fly, messing up and fixing them along the way. Regex’s are incredibly powerful, and one power they have are referred to as backreferences, which essentially allow you to use a match within the same regular expression. The easiest way to explain a backreference is with a simple goal: using a regex to simulate destructuring. Take the following code snippet: const body = document.blah.body; With…

Read More