Nikhilesh Aleti has Published 97 Articles

Best way to find length of JSON object in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

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

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

242 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

Reorder an array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:04:11

8K+ Views

The given task is to reorder an array in JavaScript. We can reorder the elements in the array by using the following methods. One of the ways to achieve the above task is b using sort() method. The sort() is an in-built method in JavaScript, which sorts the alphabetic elements. ... Read More

Generating random hex color in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 12:00:55

2K+ Views

The Hex (Hexadecimal) code is a six-digit code and a three-byte hexadecimal number that is used to represent the colors. These three bytes represent RGB which means the amount of red, green, and blue in a particular shade of a color. Each byte will represent a number in the range ... Read More

Return an array of all the indices of minimum elements in the array in JavaScript

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 22-Sep-2022 11:59:23

643 Views

An Array in JavaScript is a single variable where it can store different elements. These elements are stored at contiguous memory locations. Array elements can be accessed with the help of index numbers. The index numbers will start from 0. Syntax Below is the basic declaration of the array in ... Read More

How to remove the 0th indexed element in an array and return the rest of the elements in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Sep-2022 09:03:41

549 Views

Array is a structure, which can hold values elements and they can be accessed by referencing to them with the help of index numbers. Const colors = [“Green”, “Maroon”, “Blue”]; Reference index of array In JavaScript arrays are referred with reference indexes. These indexes are zero-indexed. The very first ... Read More

Is 'floating-point arithmetic' 100% accurate in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Sep-2022 08:53:21

372 Views

Floating point A number which is either positive or negative whole number with having a decimal point to it is called floating point. Let’s consider these numbers, 1.52, 0.14 and also -98.345 are considered as floating point numbers. Whereas 77, 56, 90 and 0 are not considered as floating point ... Read More

How to convert a string to a floating point number in JavaScript?

Nikhilesh Aleti

Nikhilesh Aleti

Updated on 19-Sep-2022 08:46:33

825 Views

In this article, we are going to discuss how to convert a string to a floating-point number in JavaScript. We can convert a string to a floating point in three ways − Using the parseFloat() method. Using the parseInt() method. Using type conversion. Using the parseFloat() method The ... Read More

Advertisements