The process.debugPort property is an inbuilt application programming interface of the process module which is used to get the debugging port used by the debugger if enabled.
Syntax:
process.debugPort
Return Value: This property returns an integer value that specifies the debugging port used by the debugger if enabled.
Below examples illustrate the use of process.debugPort property in Node.js:
Example 1:
const process = require( 'process' );
console.log( "debug port is " + process.debugPort);
|
Output:
debug port is 9229
Example 2:
const process = require( 'process' );
var debug_port = process.debugPort;
if (debug_port != undefined){
console.log( "debug port is defined" );
console.log( "debug port is " + debug_port);
} else {
console.log( "debug port is not defined" );
}
|
Output:
debug port is defined
debug port is 9229
Note: The above program will compile and run by using the node filename.js
command.
Reference: https://nodejs.org/api/process.html#process_process_debugport
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
12 Oct, 2021
Like Article
Save Article