Nikhilesh Aleti has Published 58 Articles

Splitting an array into chunks in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 17:57:39

In this article the given task is to split array elements into n sized chunks in JavaScript. We have some approaches to perform the splitting operation on array, those will be discussed below. Let’s assume some simple input and output scenarios – Assume there is an array containing elements in it. ... Read More

JavaScript/ Typescript object null check?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 17:20:30

In this article we will check if an object is a null in Typescript. A variable is undefined until and unless it is not assigned to any value after declaring it. NULL is known as empty or dosen’t exist. In typescript, unassigned values are by default undefined, so in order ... Read More

Remove leading zeros in array - JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 17:12:28

In this article, the given task is to remove the leading zeros in an array in JavaScript. Before we dive into the examples, let’s get an understanding of the problem by looking at the input-output scenarios below. Input-Output Scenario Let’s look into some input-output scenarios - Assume that we are ... Read More

Decimal count of a Number in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 17:09:00

Given there is a number with digits after decimal point and the task is to find the count of digits after the decimal point. Input Output Scenario Let’s look into the input output scenario, where there is a floating point number having some digits after decimal point. Input = ... Read More

Removing all the empty indices from array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 17:06:35

Given there is an array with some empty indices and need to remove those empty indices from array. Let’s look into the input output scenarios – Consider there is an array with some empty indices. Now we need to exclude them and return the elements which are having only truthy ... Read More

Filter array based on another array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 17:03:04

In this article, we are going to learn how to filter an array based on another array in JavaScript. An Array in JavaScript is used to store different elements. These elements are stored at contiguous memory locations. By using index numbers, we can access any or each data element present ... Read More

Picking the largest elements from multidimensional array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 17:00:28

Given a multidimensional array and the task is to pick the largest elements from it in JavaScript. The multidimensional arrays are an arrays inside an array. whenever there are arrays inside the array it will work as multidimensional array. Following is the one-dimensional array - const arr = ... Read More

What is Event Capturing in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 16:56:35

In this article, we are going to discuss the event capturing in JavaScript with an appropriate example. Event capturing is opposite to the event bubbling. In event capturing the flow goes from outermost element to the target element. Whereas in case of event bubbling the flow goes from target element ... Read More

How to implement quick sort in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Dec-2022 16:54:07

In this article, we are going to discuss how to implement quick sort in JavaScript with suitable examples. Quick sort The Quick sort is a divide and conquers algorithm similar to the merge sort. In this, we pick a pivot element and divide the array around the pivot element. There are ... Read More

Pre-order traversal in a Javascript Tree

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 18-Nov-2022 07:47:20

Tree is a hierarchical data structure which includes nodes and edges to it. Edges in tree acts as links connecting two nodes. The Preorder tree traversal is a technique where the root node will be traversed first and then it will traverse the left subtree followed by the right subtree. ... Read More

Advertisements