Below is the exercise 5 of nodeschool learnyounode module
Create a program that prints a list of files in a given directory, filtered by he extension of the files. You w
Your problem is just a typo. You're doing this:
if(ext == ext){ // you're comparing the same variable
console.log(filename);
}
, but you should be doing this:
if(ext === ext1){ // try to use '==='
console.log(filename);
}
Other thing: they're not considering the . of .txt in the input, so you have to append this in your variable ext1 because .extname(file) returns the extention with the .:
var ext1 = '.' + process.argv[3];