Hi, I’m a newbie to Javascript and I’ve been running into problems with the way Glitch works. What usually works on my computer may not work on Glitch. Tried to search on other forums, found nothing.
Here is the code, oversimplified:
const { fs } = require('fs');
const load = (dir = "./commands/") => {
fs(dir).forEach(dirs => {
//some code stuff
});
};
load();
When calling load
, I get an error
fs(dir).forEach(dirs => {
^
TypeError: fs is not a function
Why is it not working? This same code works perfectly fine on my computer.
Also removing {}
in fs
declaration makes no difference.
Thank you.