Nikhilesh Aleti has Published 97 Articles

Removing property from a JSON object in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

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

5K+ Views

A JSON (JavaScript object notation) Object is always surrounded by the curly braces {}. The values must be a valid JSON data type, and the keys must be strings. JSON supports the following data types: number, string, object, Boolean, array, and null. There has to be a colon ... Read More

Finding product of Number digits in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 23-Sep-2022 11:13:42

1K+ Views

We are required to write a JavaScript program that takes in a number and finds the product of all of its digits. Input output scenarios Assume there is a number digit assigned to a variable and task is to find the product of the number. Input = 12345; Output ... Read More

Finding the mid of an array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 23-Sep-2022 11:11:29

2K+ Views

An Array in JavaScript is datatype which is used to store homogeneous elements. These elements are stored at contiguous memory locations. We can access each data element in the array with the help of index numbers. The index numbers will start from 0. Syntax Following is the syntax of creating ... Read More

Return the sum of two consecutive elements from the original array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 23-Sep-2022 11:09:39

1K+ Views

An Array is known as collection of similar data elements which are stored at contiguous memory locations. Array is such a simple data structure where we can access each data element in the array with the help index numbers, which starts from 0. The following is the basic declaration ... Read More

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

2K+ 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

Advertisements