Skip to content

Instantly share code, notes, and snippets.

@macikokoro
Created August 2, 2014 05:56
Show Gist options
  • Save macikokoro/ed1dc6d667ff3e71b99d to your computer and use it in GitHub Desktop.
Save macikokoro/ed1dc6d667ff3e71b99d to your computer and use it in GitHub Desktop.
Poplar Puzzlers codeschool
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