The old mind puzzler, now as a 90 byte function.
var dollar = 100; var coins = [100, 50, 25, 10, 5, 1]; f(dollar, coins); // 293
var twoPound = 200; var coins = [200, 100, 50, 20, 10, 5, 2, 1]; f(twoPound, coins); // 73682
U mad Project Euler? http://projecteuler.net/problem=31
Hmm... I think you misunderstand the
c |= e = 0
.It's actually
c = c | (e = 0)
, which means each function call owns a counter, and|0
is to prevent the c as undefined in the first call.