Exercise on Proxies
Using your knowledge of proxies object, you must use them to: i) log the number of times a function is accessed ii) create a revocable discount object
We'll cover the following
Exercise 1:
Suppose the following fibonacci
implementation is given:
fibonacci = n =>
n <= 1 ? n :
fibonacci( n - 1 ) + fibonacci( n - 2 );
Determine how many times the fibonacci
function is called when evaluating fibonacci( 12 )
.
Determine how many times fibonacci
is called with the argument 2
when evaluating fibonacci( 12 )
.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.