AmitDiwan has Published 10744 Articles

No. of ways to empty an array in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:33:16

202 Views

To empty an array in JavaScript, there are four ways −Setting to new Array − In this we set our array variable to a new empty array.Using length property − In this we set the length property of our array to 0.Using pop − In this we continuously pop the ... Read More

How to implement asynchronous loop in JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:31:59

185 Views

Following is the code to implement asynchronous loop in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;       color: ... Read More

What is the best way to add an event in JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 09:12:58

139 Views

The best way to add an event to any element is to use the addEventListener() method.Following is the code to add an event in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result{ ... Read More

JavaScript program to decrement a date by 1 day

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 09:11:04

260 Views

Following is the code to decrement a date by 1 day in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result, .sample {       font-size: 20px;       font-weight: 500; ... Read More

How to find keys of a hash in JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 09:09:10

420 Views

Following is the code for finding keys of a hash in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;    } ... Read More

How can we validate decimal numbers in JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 09:02:49

521 Views

Following is the code to validate decimal numbers in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;    } ... Read More

How can I remove a child node in HTML using JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 08:58:54

199 Views

Following is the code to remove a child node in HTML using JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;   ... Read More

How to load a JavaScript file Dynamically?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 08:56:27

637 Views

Following is the code to load a JavaScript file dynamically −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;    } ... Read More

Named arguments in JavaScript.

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 08:53:14

233 Views

Following is the code for using named arguments in JavaScript functions −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample, .result {       font-size: 18px;       font-weight: 500;     ... Read More

Can we have a return statement in a JavaScript switch statement?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 08:47:22

21K+ Views

The JavaScript switch statement can contain return statements if it is present inside a function. The function will return the value in the switch statement and the code after the switch statement will not be executed.Following is the code to have return statements in JavaScript switch statement −Example Live Demo ... Read More

Advertisements