For example I have a file app.js and greet.js module is it possible to call the local greet function without having to rename it?
//Contents of app.js
var greet = require('./greet.js');
//local greet function, how do I call this one?
function greet() {
console.log('hi');
}
greet(); //Call greet in module
//Smashing the modules import of greet
var greet = function () {
console.log("Hello pal!");
}
greet();
and the other file is greet.js
var greet = function () {
console.log("Hello from module!");
}
module.exports = greet;
via MrDaniel
No comments:
Post a Comment