The tutorial says:
Define a function named callFunc that takes one argument, a function
f. It should return an array containing the values f(0), f(0), f(1),
f(1). You can only call f twice.
This is what the tutorial gives:
var count = 0;
var f = function (x) {
count += 1;
return x + 2;
};
var callFunc = function (f) {
};
I have no idea how to use count to pass this tutorial.
Any suggestions?
You don’t need to use
count. Just callf()twice and put the return values into an array: