Java Reference
In-Depth Information
twoExp = power(2);
<< function (power) {
return Math.pow(x,power);
}
twoExp(5);
<< 32
We can create another function called tenExp() that returns powers of 10 :
tenExp = power(10);
<< function (power) {
return Math.pow(x,power);
}
tenExp(6);
<< 1000000
If a function returns another function, instead of assigning the returned function to a vari-
able then calling it, the returned function can be invoked immediately using double paren-
theses:
power(3)(5);
<< 243
Search WWH ::




Custom Search