I am trying to give some examples under my belt about how you will do something different in CoffeeScript for JavaScript. In this example of queue functions, I am confused about how you handle this in CoffeeScript
wrapFunction = (fn, context, params) ->
return ->
fn.apply(context, params)
sayStuff = (str) ->
alert(str)
fun1 = wrapFunction(sayStuff, this, ['Hello Fun1'])
fun2 = wrapFunction(sayStuff, this, ['Hello Fun2'])
funqueue = []
funqueue.push(fun1)
funqueue.push(fun2)
while (funqueue.length > 0) {
(funqueue.shift())();
}
Especially how to rewrite this in CoffeeScript?
while (Array.length > 0) {
(Array.shift())();
source
share