How does node know that MyClass is the file "js/MyClassFile.js"?
Node decides it on basis of relative path so if you are in js
folder and try to use var mine = require('myClass');
then it means then myClass
is in js
folder
for html equivalent you need to use modules but you can do it in es6
like this, please note es6 support is still limited
// lib/math.js
export function sum (x, y) { return x + y }
export var pi = 3.141593
// someApp.js
import * as math from "lib/math"
console.log("2π = " + math.sum(math.pi, math.pi))
// otherApp.js
import { sum, pi } from "lib/math"
console.log("2π = " + sum(pi, pi))
otherwise you can look at this How do I include a JavaScript file in another JavaScript file?