我这样写咖啡脚本:
split_typer_text = typer_text.split ''
test = (char) ->
setTimeout (-> element.text(element.text() + char)), 100
test char for char in split_typer_text
但是coffeescript将其编译为:
test = function(char) {
return setTimeout((function() {
return element.text(element.text() + char);
}), 100);
};
_results = [];
for (_i = 0, _len = split_typer_text.length; _i < _len; _i++) {
char = split_typer_text[_i];
_results.push(test(char));
}
return _results;
我想要运行功能,不需要数组。怎么做?