I thought this was a great challenge and worthy of reposting. It has to do with array selection and function expressions.
See if you can figure it out!
“What is obtained when the result of passing 9 into function 4 is then passed into the function whose array index matches the result of passing 3 into function 2?”
var puzzlers = [ function ( a ) { return 8*a - 10; }, function ( a ) { return (a-3) * (a-3) * (a-3); }, function ( a ) { return a * a + 4; }, function ( a ) { return a % 5; } ];
The expression used in your alert should:
1. Involve no manual calculation or hard-coded math on your part.
2. Use indices of arrays to access functions.
3. Use parentheses to pass in parameters to immediately-invoking functions.
4. Use just one line of code.