Wednesday, April 6, 2011

Ex. 3.2 Inline...

Write a function greaterThan, which takes one argument, a number
>>function GreaterThan(argument) {

and returns a function that represents a test
>>  return function test(number) {

It returns a boolean: true if the given number is greater than the number that was used to create the test function, and false otherwise.
>>    return number > argument;
>>  };
>>}

When this returned function is called with a single number as argument
>>var gt10 = GeaterThan(10);

For this part I checked the answer...
>>show (gt10(9));