Nikhilesh Aleti has Published 93 Articles

What is Fisher–Yates shuffle in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 23-Sep-2022 11:00:04

4K+ Views

Given an array, and generate the random permutation of array elements. It is similar like shuffling a deck of cards or randomize an array and every outcome after shuffling of array elements should likely and equally. Input output scenarios Consider an array having some elements present in it and assume ... Read More

How to implement insertion sort in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 23-Sep-2022 10:58:22

1K+ Views

Insertion Sort The Insertion Sort is a sorting algorithm that works very similar to the way we sort the playing cards when we play. The arrangement of elements in a sorted manner. In this algorithm, the array will be divide virtually into two parts which are sorted and unsorted parts. ... Read More

How to implement merge sort in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 23-Sep-2022 10:53:24

9K+ Views

Merge Sort The Merge Sort algorithm, where we can sort the elements in a particular order. This algorithm is also considered as an example of divide and conquer strategy. In merge sort algorithm, firstly the array will be divided into two parts and combined a particular sorted manner. ... Read More

How to Split large string in to n-size chunks in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 23-Sep-2022 10:51:32

3K+ Views

A string is an order of one or more characters that contain numbers, letters, symbols, or special characters. In JavaScript strings are immutable. i.e., once you create a string you cannot change its value. For example, consider the following snippet here we have created a string variable and assigned ... Read More

Sort array of objects by string property value in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:24:14

3K+ Views

The given task is to sort an array of objects by using string property value in JavaScript. Assume there is an array of objects and we need to sort those elements by using the string property. In this below scenario, we are sorting array of objects by "company" property. const ... Read More

How to replace elements in array with elements of another array in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:22:02

6K+ Views

The given task is to replace the elements in an array with elements of another array. Input-Output Scenario Let’s look into some input-output scenarios. Consider there are there two arrays with elements in it. The first array is having more elements than the second array and we are replacing a ... Read More

Best way to find length of JSON object in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:19:37

14K+ Views

In this article, the given task is to get the best way of finding the length of a JSON object in JavaScript. Input-Output Scenario Let’s look into this input-output scenario. Consider there is an object with some keys and values in it. we need to get the length of the ... Read More

Removing Negatives from Array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:18:22

1K+ Views

The given task is to remove the negative values from the array. Input-Output Scenario Let’s look into input output scenarios. Consider there is an array and it is having both negative and positive integer values. We need to remove the negative values from the array and return the array. Input ... Read More

Join arrays to form string in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:16:03

252 Views

The given task is to perform joining arrays to form strings in JavaScript. Input-Output Scenario Let’s look into some input-output scenarios. Consider there is an array having some elements in it and we are trying to join that array to form the string. Input = [32, 45, 65, 12, 07, ... Read More

Match specific word in regex in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:05:51

10K+ Views

The task is to match a specific word or character which is in regex with a string. The regex (regular expressions) is a pattern that is used to match character combinations in strings. Here we include the test(), match(), and matchAll() methods to match the following word in regex. We ... Read More

Advertisements