Node.js process.traceDeprecation Property
Last Updated :
10 Jun, 2021
The process.traceDeprecation property is an inbuilt application programming interface of the process module which is used to indicate whether the –trace-deprecation flag is set on the current Node.js process.
Syntax:
process.traceDeprecation
Return Value: This property indicates whether the –trace-deprecation flag is set on the current Node.js process.
Below examples illustrate the use of the process.traceDeprecation property in Node.js:
Example 1:
index.js
const process = require( 'process' );
console.log(process.traceDeprecation);
|
Run the index.js file using the following command:
node --trace-deprecation index.js
Output:
true
Again run the same file, but using the different command as shown below:
node index.js
Output:
undefined
Example 2:
Filename: index.js
Javascript
const process = require( 'process' );
process.traceDeprecation = false ;
console.log(process.traceDeprecation);
process.traceDeprecation = true ;
console.log(process.traceDeprecation);
|
Run the index.js file using the following command:
node --trace-deprecation index.js
Output:
true
true
Again run the same file, but using the different command as shown below:
node index.js
Output:
false
true
Share your thoughts in the comments
Please Login to comment...