function times(a, b){
return b === 0
? 0
: a + times(a,b - 1);
}
function double(n){
return n + n;
}
function halve(n){
return n / 2;
}
function fast_times(a, b){
return b === 0
? 0
: is_even(b)
? fast_times(double(a), halve(b))
: a + times(a ,b - 1);
}
function is_even(n) {
return n % 2 === 0;
}
728x90