Proper and consistent use of `path.extname`

- `path.extname` returns a extension name, including the leading ".";
- Use `path.extname` in both examples;
- Consistent coding style for variable assignment at the top of each examples.