You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
621 B
JavaScript

8 months ago
var call_counter = require("./call_counter");
function mulitply(x, y) {
call_counter();
return x * y;
}
function divide(x, y) {
call_counter();
return x / y;
}
function fibo(count) {
call_counter();
return private_fibo(count);
}
function private_fibo(count, counter, first, second) {
if(count == 0)
return 0;
if(counter == undefined) {
counter = 1;
first = 1;
second = 2;
}
result = first + second;
if(counter == count)
return result;
private_fibo(count, ++counter, second, result);
return result;
}
module.exports = {
multiplication: multiply,
division: divide,
fibonacci: fibo
}