Node js Path Module

Node js Path Module
0
**In following Example1 filename doesn't exist shows and current
 directory shows as it**
**Exampl1**

const path=require('path');

const fs=require('fs');

var file="E:\\kamalakar\\Freecodecamp\\practise\\nodejs.."

var filename="temp.txt" // it is in E:\kamalakar\Freecodecamp\practise

process.chdir(file);

fs.exists(filename,(exists)=>

{

if(exists)

{

console.log(filename+" exist")

}

else

{

console.log(filename+" doesn't exist")

}

})//temp.txt dosen't exist

console.log(path.isAbsolute(file));//true

console.log(process.cwd());//E:\kamalakar\Freecodecamp\practise\nodejs


**But  in following Example2**  current directory is diiferent and 
file is not present in that ditectory still it shows file exists

const path=require('path');

const fs=require('fs');

var file="C:\\Windows\\Fonts\\Perpetua\\.."

var filename="AGENCYB.TTF" // real path name "C:/Windows/Fonts/Agency FB/.."

process.chdir(file);

fs.exists(filename,(exists)=>

{

if(exists)

{

console.log(filename+" exist")

}

else

{

console.log(filename+" doesn't exist")

}

})//AGENCYB.TTF exist

console.log(path.isAbsolute(file));//true

console.log(process.cwd());//C:\Windows\Fonts