There's a function in the "path" library that allows you to extract the extension of a file. Also, use strict comparison instead of non strict. i.e. !== instead of !=