Node.js · Junior · Question 45 of 75
How is path.resolve() different from path.join()?
- 1
resolvechecks that the file exists - 2
resolveonly works with URLs - ✓Correct answer:
resolvealways returns an absolute path, starting from the current working directory if needed
Explanation
path.resolve("a", "b") gives something like /home/me/project/a/b. A segment starting with / resets the result to the root.