For -> forEach + use path module

- Switched from using RegEx to using Node's standard path library to get the extension name
- Switched for loop to for each on files array.
extraneous newline