file1.js
console.log("foo")
file2.js
require("./file1")
➜ node file2.js
foo
How would I convert file2.js's require to import and keep the same logic (so no assignment)?
You can use like below, this will import file1 to file2
import './file1';
This is useful when you want to execute the file1 code but does not want to assign it to the variable. ex:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With