I have a simple javascript question. I have two files, a.js and b.js defined in the same directory.
Within a.js I define a function:
function foo() {
console.log('Hello World!');
}
in b.js I have:
var a = require('./../scenarios/a.js');
a.foo();
However, when I run node b.js, I get:
b.js:4
a.foo();
^
TypeError: a.foo is not a function
at Object.<anonymous> (/Users/dlumma/dev/bloomguild-applitools-sunbasket/scenarios/b.js:4:3)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3
Any clue what I am doing wrong?