Node.js · Junior · Question 46 of 75
Why use the path module instead of joining paths with + "/" +?
- 1
pathmakes file access faster - ✓Correct answer: It uses the correct separator for each OS and normalizes the result
- 3String concatenation is not allowed for paths
Explanation
Windows uses \ while Linux and macOS use /. path also helps with extensions (path.extname) and file names (path.basename).