Because you are not export myFunc as object, you should call test2(), in test2.js
const test2 = require('./test1.js');
console.log(test2());
or you can export myFunc as object, in test1.js
const myFunc = () => {
return "Hello World!";
};
module.exports = {myFunc};