AmitDiwan has Published 10740 Articles

Type casting in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:20:08

8K+ Views

Type casting means conversion of one data type to another explicitly. In JavaScript some of the most common methods to convert a datatype to either string using String(), to boolean using Boolean(), or to number using Number().Following is the code for type casting in JavaScript −Example Live Demo ... Read More

What is JavaScript type coercion?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:17:18

248 Views

Type coercion means conversion of a datatype to another automatically or implicitly.Following is the code for JavaScript type coercion −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result, .sample {       font-size: ... Read More

Explain the finally Statement in JavaScript with examples.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:12:21

217 Views

The finally statement always executes after try and catch block regardless of if there was an error or not.Following is the code for the finally statement in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;   ... Read More

Returning values from a constructor in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:10:03

211 Views

Following is the code for returning values from a constructor 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

Creating JavaScript constructor using the “new” operator?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:07:23

173 Views

Following is the code for creating a JavaScript constructor using the ‘new’ operator −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 add a property, method to a JavaScript constructor?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:05:10

249 Views

Following is the code to add a property, method to a JavaScript constructor −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 stop a function during its execution in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:04:12

5K+ Views

To stop a function during its execution, use the concept of −document.getElementById().addEventListener().Example Live Demo Document Call the function Stop the function execution    document.getElementById("call").addEventListener("click", callFunction);    document.getElementById("halt").addEventListener("click", haltFunction);    var timeValue = null;    function callFunction() {       ... Read More

How to add, access, delete, JavaScript object properties?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 07:02:23

180 Views

Following is the code to add, access and delete JavaScript object properties −Example Live Demo

Range Overflow and Range Underflow properties in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 06:59:54

773 Views

Range Underflow − If the element value is less than that of the specified in min attribute, it sets to true.Range Overflow − If the element value is more than that of the specified in max attribute, it sets to true.Following is the code for Range overflow and range underflow ... Read More

How to convert JSON text to JavaScript JSON object?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 06:57:01

884 Views

The JSON parse() method is used for converting a JSON text to a JavaScript object.Following is the code for converting JSON text to JavaScript JSON object −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }   ... Read More

Advertisements