1

As I understand it, in order for the variables assigned to within a jasmine beforeEach to be accessible by the specs it applies to, the variables have to be declared in the containing block. I'm trying to find the least verbose way of doing this using coffeescript and came up with:

[var1, var2, var3, ..., varn] = [undefined]

Is there a better way?

4

1 回答 1

1

你可以放弃undefined我想:

[var1, var2, var3, ..., varn] = []

我想不出别的了。一个更好的问题是为什么你首先需要这么多全局变量:如果你需要这么多变量而显式定义它们是繁重的,那么也许你有太多变量。

于 2013-06-12T23:49:33.647 回答