PageRenderTime 14ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
JavaScript | 42 lines | 32 code | 9 blank | 1 comment | 3 complexity | f8e80e852322fb9228f90872cd81fe85 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. // https://developer.mozilla.org/en/New_in_JavaScript_1.7
  2. [a, b] = [b, a];
  3. function f() {
  4. return [1, 2];
  5. }
  6. [a, b] = f();
  7. for (let [name, value] in Iterator(obj)) {
  8. print(name);
  9. print(value);
  10. }
  11. for each (let {name: n, family: { father: f } } in people) {
  12. print(n);
  13. print(f);
  14. }
  15. var [a, , b] = f();
  16. [,,,] = f();
  17. function g() {
  18. var parsedURL = /^(\w+)\:\/\/([^\/]+)\/(.*)$/.exec(url);
  19. if (!parsedURL)
  20. return null;
  21. var [, protocol, fullhost, fullpath] = parsedURL;
  22. }
  23. function h(a, [b, c], {foo: d, 'bar': e}) {
  24. f();
  25. g();
  26. }
  27. x = function([a, b]) a + b;
  28. ({x: x0, y: y0}) = point;
  29. var {x: x0, y: y0} = point;
  30. let ({x: x0, y: y0} = point) {
  31. print(x0);
  32. print(y0);
  33. }