AmitDiwan has Published 10744 Articles

How to add a property to a JavaScript object using a variable as the name?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:18:48

305 Views

In this article, you will understand how to add a property to a JavaScript object using a variable as the name. Adding property to an object can be achieved by two methods. The first is the dot (.) notation and the second is using the brackets([]). Example 1 In this ... Read More

How to add float numbers using JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:16:40

4K+ Views

In this article, you will understand how to add float numbers using JavaScript. Float values in JavaScript are defined as parseFloat(string). Example 1 In this example, let’s understand adding float values without using functions. let inputFloat1 = parseFloat(2.3) let inputFloat2 = parseFloat(3.5) console.log("The two float values are defined as ... Read More

How to add a parameter to the URL in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:14:49

27K+ Views

In this article, you will understand how to add a parameter to the URL in JavaScript. There are two methods to add parameters to an url: append() method and set() method. The append() method is used to specifically add key-value pairs to the url. The set() method adds the value ... Read More

How to access the first value of an object using JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:12:13

11K+ Views

In this article, you will understand how to access the first value of an object using JavaScript. The first value of the object is the first property located at position[0] of the object. The object can be a key-value object or an array object. Example 1 In this example, let's ... Read More

How to access an object having spaces in the object’s key using JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:10:06

1K+ Views

In this article, you will understand how to access an object having spaces in the object’s key using JavaScript. In such cases, we use bracket notation ‘[]’ to access objects or we use dot notation(.) to access objects. Let’s see a few examples below. Example 1 In this example, let's ... Read More

How optional chaining works in TypeScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:08:00

399 Views

In this article, you will understand how optional chaining works in TypeScript. Optional chaining operator (?.) accesses an object’s property. If the objects property is null or not defined, it returns ‘undefined’. Let us first understand what TypeScript is. Strongly typed programming language TypeScript, which is based on JavaScript, gives ... Read More

How many numbers in the given array are less/equal to the given value using the percentile formula in Javascript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:04:53

155 Views

In this article, you will understand how many numbers in the given array are less/equal to the given value using the percentile formula. We calculate the percentage of numbers in the given array less or equal to the number using the formula − Percentile = (n/N) * 100 ... Read More

How ES6 (ES2015) evolved and brought new features to modern day JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 14:59:50

163 Views

In this article, you will understand how ES6 (ES2015) evolved and brought new features to modern day JavaScript. ES6 stands for ECMAScript 6. It is the 6th version of ECMAScript and was created to standardize the JavaScript. The top 10 features of ES6 are: let and const keywords, Arrow ... Read More

How does Promise.any() method differs from Promise.race() method in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 13:52:21

119 Views

In this article, you will understand how Promise.any() method differs from Promise.race() method in JavaScript. The Promise.any() method in javascript is one among promise concurrency methods. It is useful when the first task needs to be completed. The Promise.race() method in javascript is one among promise concurrency methods. It is ... Read More

How Check if object value exists not add a new object to array using JavaScript ?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:47:37

1K+ Views

In this article, you will understand how to check if the object value exists, if not, add a new object to the array using JavaScript. In Javascript, almost every variable is an object. An object can be a string, numbers, boolean values, etc. They can also be key-value pairs. An ... Read More

Advertisements