Global Variables?


#1

Trying to make variables carry on to other files, for example:
In the first file:
const color = ‘#36393E’;
In the second file:
I try to use color, and it never works…

I might just be stupid, any help is appreciated…
I am making a discord.js bot, which shouldn’t matter (but it’s here if you wanted to know)


#2

You need to export that variable using
module.exports = color
Then require the file


#3

I’ve tried that (friend told me to) and it doesn’t work either, I don’t know if it just doesn’t work on glitch or something, but it’s odd…


#4

Try sharing your project so folks can highlight where you’re going wrong.