PageRenderTime 3ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/documentation/js/overview.js

http://github.com/jashkenas/coffee-script
JavaScript | 45 lines | 35 code | 9 blank | 1 comment | 4 complexity | 1d89178ae3a838c11f6a4d7ad80bc81d MD5 | raw file
  1. // Generated by CoffeeScript 1.10.0
  2. var cubes, list, math, num, number, opposite, race, square,
  3. slice = [].slice;
  4. number = 42;
  5. opposite = true;
  6. if (opposite) {
  7. number = -42;
  8. }
  9. square = function(x) {
  10. return x * x;
  11. };
  12. list = [1, 2, 3, 4, 5];
  13. math = {
  14. root: Math.sqrt,
  15. square: square,
  16. cube: function(x) {
  17. return x * square(x);
  18. }
  19. };
  20. race = function() {
  21. var runners, winner;
  22. winner = arguments[0], runners = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  23. return print(winner, runners);
  24. };
  25. if (typeof elvis !== "undefined" && elvis !== null) {
  26. alert("I knew it!");
  27. }
  28. cubes = (function() {
  29. var i, len, results;
  30. results = [];
  31. for (i = 0, len = list.length; i < len; i++) {
  32. num = list[i];
  33. results.push(math.cube(num));
  34. }
  35. return results;
  36. })();