Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Node.js – process.throwDeprecation() Method
This method indicates about the flag value of --throw-deprecation which is set to True or False on the current Node.js project.
The process.throwDeprecation() method is mutable, so the deprecation warning results in errors may be altered at runtime.
Syntax
process.throwDeprecation( )
Example 1
Create a file with the name "throwDeprecation.js" and copy the following code. After creating the file, use the command "node throwDeprecation.js" to run this code as shown in the example below
// process.throwDeprecation() Demo Example
// Importing the process module
const process = require('process');
// Printing the --throw-Deprecation default value
console.log(process.throwDeprecation);
Output 1
undefined
Output 2
true
Example 2
Let's take another example
// process.throwDeprecation() Demo Example
// Importing the process module
const process = require('process');
// Initializing the throwDeprecation flag
process.throwDeprecation = false;
// Printing throwDeprecation
console.log(process.throwDeprecation);
// Initializing the throwDeprecation flag
process.throwDeprecation = true;
// Printing throwDeprecation
console.log(process.throwDeprecation);
Output 1
false true
Output 2
true true
Advertisements
