AmitDiwan has Published 11365 Articles

How to calculate days left until next Christmas using JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:22:58

648 Views

In this article, you will understand how to calculate days left until next Christmas using JavaScript. The Date object works with dates and times. Date objects are created with new Date(). JavaScript will use the browser's time zone and display a date as a full text string. Example 1 In ... Read More

How to calculate local time in Node.js?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:20:25

5K+ Views

In this article, you will understand how to calculate local time in Node.js. The Date object works with dates and times. Date objects are created with new Date(). JavaScript will use the browser's time zone and display a date as a full text string. Node.js is an open-source and cross-platform ... Read More

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

202 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

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

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

896 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

292 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

117 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

71 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

Advertisements