Created
August 2, 2014 05:56
-
-
Save macikokoro/ed1dc6d667ff3e71b99d to your computer and use it in GitHub Desktop.
Poplar Puzzlers codeschool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | |
]; | |
var start = 2; | |
var applyAndEmpty = function( input, queue ) { | |
var length = queue.length; | |
for(var i = 0; i<length; i++){ | |
input = queue.shift()(input); | |
} | |
return input; | |
}; | |
alert(applyAndEmpty(2, puzzlers)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment