Lesson 1: Getting started with Node.js CHAPTER 8 353
console.log('addition(5,10) = ' + result);
console.log();
result = math_example.subtraction(50,10);
console.log('subtraction(50,10) = ' + result);
console.log();
result = math_example.multiplication(3,7);
console.log('multiplication(3,7) = ' + result);
console.log();
result = math_example.division(27,3);
console.log('division(27,3) = ' + result);
console.log();
result = math_example.fibonacci(3);
console.log('fibonacci(3) = ' + result);
console.log('done');
This code sets a reference to the math_example package. The code executes a small test of
each of the exported functions. Run the code by executing the following command.
node main
The result is shown in Figure 8-6. Each function returns a result, and then the result is
displayed.
FIGURE 8-6 he result of executing node mainT