Open this example in the interactive library
Source code
import path from "node:path";
console.log(path.extname("archive.tar.gz"), path.extname(".gitignore"));
Sample output
.gz

Open this example in the interactive library
import path from "node:path";
console.log(path.extname("archive.tar.gz"), path.extname(".gitignore"));
.gz