PageRenderTime 346ms CodeModel.GetById 197ms app.highlight 2ms RepoModel.GetById 146ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/tests/javascript/javascript-array-comprehension.js

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
JavaScript | 14 lines | 9 code | 3 blank | 2 comment | 9 complexity | 64e56eb066b08a110fc0f3dd84eda064 MD5 | raw file
 1// https://developer.mozilla.org/en/New_in_JavaScript_1.7
 2
 3function range(begin, end) {
 4  for (let i = begin; i < end; ++i) {
 5    yield i;
 6  }
 7}
 8var ten_squares = [i * i for each (i in range(0, 10))];
 9var evens = [i for each (i in range(0, 21)) if (i % 2 == 0)];
10
11// test optimization
12var optimized = [i for each (i in x) if (0)];
13
14[i for each (a in x) for each (b in y)]