Hey everyone,
When this code calls the function setTimer(), the second parameter is all that code.Code:function setTimer( remain, actions ) { (function countdown() { display("countdown", toMinuteAndSecond(remain)); actions[remain] && actions[remain](); (remain -= 1) >= 0 && setTimeout(arguments.callee, 1000); })(); } setTimer(userInput, { 10: function () { display("notifier", "Just 10 seconds to go"); }, 5: function () { display("notifier", "5 seconds left"); }, 0: function () { display("notifier", "Time is up"); } });
What are they doing with all 10: 5: and 0: and how doesactions[remain] && actions[remain]();work?
I'm sorry if I wasn't clear.



Reply With Quote

Bookmarks