How to find consecutive repeated characters in a string in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, I’m going to show you how I find consecutive repeated characters in a string, here I will use some regex expression and javascript test() method to validate consecutive repeated characters in an array. The test() method executes a search for a match between a regular expression and a specified string. Returns true or false. Well, let’s start today’s topic How to find consecutive repeated characters in a string in javascript?...

May 22, 2022 · 2 min · Infinitbility

How to find and remove element from array in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, I’m going to show you how do I find and remove elements from an array in javascript, here I will use the javascript findIndex() method and some conditions to find the exact object in the array, and the splice() method to remove a specific element from an array using element index value. The findIndex() method returns the index of the first element in the array that satisfies the provided testing function....

May 21, 2022 · 2 min · Infinitbility

How to find the index of an object in an array in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, I’m going to show you how I find the index of an object in an array, here I will use the javascript findIndex() method and some conditions to find the exact object in the array. The findIndex() method returns the index of the first element in the array that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test....

May 21, 2022 · 2 min · Infinitbility

How to concat two strings in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to learn concat two strings in javascript, here we will use the plus ( + ) operator to join both strings, we will also see append strings with separators like comma (,). The plus operator basically used for adding but if you use this operator between strings it will concat string. Well, let’s start today’s tutorial How to concat two strings in javascript?...

May 20, 2022 · 1 min · Infinitbility

How to append an array to another array in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we will learn to append an array to another array in javascript, here we will use the array concat() method to merge two arrays. The concat() method The concat() method is used to merge two or more arrays. This method does not change the existing arrays but instead returns a new array. – MDN So, here we will create two sample arrays like the below example, after that, we will use concat() method to append one array to another, and store it in the third array variable....

May 19, 2022 · 1 min · Infinitbility

How to append array to object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we will learn to add an array in an object in javascript, here we will use some common syntax of an object to store an array to an object. To add an array in the object, we will use object add elements syntax, where we have to just assign an array to an object like assign to any variable. Well, let’s start the today’s tutorial How to append an array to object in javascript?...

May 19, 2022 · 2 min · Infinitbility

How to get all values from nested json object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we will see how can we get all values from nested JSON objects, here we will use a custom function which will return the list of values available in a nested JSON object. So, we will create a function that navigates every possible object’s key and value and add values in an array that returns at the end of recursive loops. Well, let’s create a function that returns the values of nested objects....

May 18, 2022 · 2 min · Infinitbility

How to get count of json object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ To get length of json object in javascript, just use the Object.keys() method with the length property. it will return the length of the object. Today, we will learn How to get a count of a JSON object in javascript, here we will use the keys() method and array length to get a count of a JSON object. Basically, The keys() method creates an array of object keys, and when we get an array, we will use simple array length syntax to get a count of objects....

May 18, 2022 · 2 min · Infinitbility

How to remove square brackets from json object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to learn the proper way to use an array and also remove brackets from JSON object string, here we will see the first ways to bypass removal brackets if this does not work you will also see how can we remove brackets from a JSON object. here, we will take three types of examples, if your case from mentioned in the first and the second case then go with their solution else follow the last o third case....

May 18, 2022 · 2 min · Infinitbility

How to get all values from json object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, You will learn to get all object values JSON object in javascript, here we will use the for.. in loop to iterate an object to get their values. Sometimes, we don’t know the keys but we to show all object values in our project, we want some dynamic way to do it, so today we are going to do the same. Here, we will use the for....

May 17, 2022 · 1 min · Infinitbility

How to get first value from json object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we will learn to get the first value from a JSON object in javascript, here we will Object.values() method to get the first value from the object. What is Object.values() The Object.values() method returns an array of a given object’s own enumerable property values, in the same order as that provided by a for…in the loop. (The only difference is that a for…in loop enumerates properties in the prototype chain as well....

May 17, 2022 · 1 min · Infinitbility

How to get all keys from nested json object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we will see how can we get all keys from JSON objects, here we will use a custom function which will return the list of keys available in a JSON object. So, we will create a function that navigates every possible object’s key and add keys in an array that returns at the end of recursive loops. Well, let’s create a function that returns the keys of nested objects....

May 16, 2022 · 2 min · Infinitbility

How to get array from json object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we will learn to get an array from a JSON object, here we will take an example of a JSON object have stored sample array data and we will try to extract an array from JSON. Basically, to access any JSON data we have to use their key, here we will also do the same we will use the object keys which have a store array....

May 16, 2022 · 2 min · Infinitbility

How to convert array of strings to comma separated string in Javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to learn how can we convert arrays which have store strings to comma (,) separated strings, here we will use the javascript join method to do this. Table of content Introduction to join() method join() method example Different separator example Let’s start today’s topic How to convert an array of strings to comma separated strings in Javascript? Introduction to join() method The join() method creates and returns a new string by concatenating all of the elements in an array (or an array-like object), separated by commas or a specified separator string....

May 15, 2022 · 2 min · Infinitbility

How to remove duplicates from array of strings in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to do how to remove duplicates from an array of strings in javascript, here we will use spread operator syntax to remove duplicate elements. When we use set() it’s we will create a unique collection, so when we pass any array in set() it will create unique elements of an array which we can also use to remove duplicates from an array....

May 15, 2022 · 1 min · Infinitbility

How to reverse array without mutating in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to learn how can we reverse an array without mutating in javascript, here we will use the javascript slice() and reverse() methods to do. Table of contents Introduction Reverse array Reverse array without mutating Let’s start today’s topic How to reverse an array without mutating in javascript? Introduction Let’s know what is a javascript slice and reverse method. The slice() method...

May 15, 2022 · 2 min · Infinitbility

How to check boolean value in if condition in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to learn how we can check the boolean value in javascript if condition, here we will discuss check boolean true and false check boolean string check boolean variable JavaScript provide check truthy value concept, where code auto handle truth values like true, "data", 1 and return false for '', false, undefined, null, 0. Well, we will go with an example, let’s first see how we can handle if we have a boolean variable....

May 11, 2022 · 1 min · Infinitbility

How to get first 5 elements of array in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to learn how to get the first 5 elements of an array in javascript, here we will use the javascript built-in method .slice() which helps us to get our desired elements from an array. The slice() method returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included) where start and end represent the index of items in that array....

May 6, 2022 · 1 min · Infinitbility

How to get number of keys of object in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ Today, we are going to learn How to get a number of keys of objects in javascript, here we will use the keys() method and array length to get a number of keys. Basically, The keys() method creates an array of object keys, and when we got an array we will use simple array length syntax to get a number of keys. Well, let’s start today’s tutorial How to get the number of keys of the object in javascript?...

May 5, 2022 · 1 min · Infinitbility

How to push array of objects in another array in javascript?

Hi Friends 👋, Welcome To Infinitbility! ❤️ This tutorial will help you to add an array of objects to another array in javascript, here we will use the push() method to insert the new array in the array. JavaScript provides the push() method to add new elements to an existing array, we have to just pass the array in the push() method. The push() method adds new elements at the last index of the array....

May 4, 2022 · 1 min · Infinitbility