matematicabisao83
Version:
Um exemplo de projeto node com operações matemáticas
14 lines (10 loc) • 741 B
JavaScript
// It looks like the internal_call_counter variable and the count_call function are polluting the global namespace, but this module
// code will be wrapped so that neither will be in the global namespace. You can define what is available when a user uses the
// require(‘call_counter’) function by assigning something to module.exports. In this case, the only exported function is count_call,
// but you can specify multiple functions by wrapping them in an object, as you’ll see in the simple_math.js and advanced_math.js modules.
var internal_call_counter = 0;
function count_call(){
++internal_call_counter;
console.log('You have made ' + internal_call_counter + ' calls!');
}
module.exports = count_call;