Tutorials Exercises Get Certified Services Menu
Log in
Sign Up Spaces Bootcamps

Node.js path.isAbsolute() Method

❮ Path Module


Check if different strings are absolute paths:

var path = require('path');

console.log(path.isAbsolute('/test/demo_path.js')); //true
console.log(path.isAbsolute('test/demo_path.js')); //false
console.log(path.isAbsolute('C:\\test\\demo_path.js')); //true
Run example »

Definition and Usage

The path.isAbsolute() method returns true if the specified path is an absolute path, otherwise false.



Parameter Values

Parameter Description
path Required. The path to check

Technical Details

Return Value: A Boolean
Node.js Version: 0.11.2

❮ Path Module