JavaScript is a dynamic and flexible, non strongly-typed language. While it opens a few doors for erroneous coding patterns, it also comes with several advantages. One of those is the…
Access string constants globally in Vue.js | Example
It's always a good idea to keep all your strings in one file and access them across your templates and js/ts files. You can of course use the data() method…
Replace a word/substring in a string in JavaScript | Example
You can replace any word or characters you want in JavaScript using the replace() method. One of the powerful features of the replace method is that not only can it…
Insert an array of objects at Nth place in an array in JavaScript | Example
In this tutorial I'm going to show you how you can insert a list of items at a particular index (and the following indices) in another array. If you want…
Insert an object at Nth position in an array of objects in JavaScript | Example
We can easily insert an object at a particular, known position in an array of objects. We can do so by first breaking the array into segments and then merging…
Merge two arrays into one array in JavaScript | Example
Just as you can break an array into separate arrays, you can always merge multiple arrays into a single one. Here's an example on how you can do that: const…
Break an array list into two arrays (lists) in JavaScript | Example
You can easily break an array containing N elements (where N>=2) into two (or more) separate arrays using the splice function. Here's an example on how you can do that:…
Update/Modify multiple property values of an Object in JavaScript | Example
Objects act a bit different in JavaScript than other programming languages. This results in both pros and cons for its uses. For instance, there are multiple ways to update property…
Merge two objects into one object in JavaScript | Example
There can be situations where you want to merge the key-value pairs of two JavaScript objects into one. You can do it in multiple ways. Here I'm going to show…
