sample-with-comments.js 841 B

12345678910111213141516171819202122232425262728293031
  1. var quicksort = function () {
  2. /*
  3. this is a multiline comment
  4. it is, I promise
  5. */
  6. var sort = function(items) { // comment at the end of a foldable line
  7. // This is a collection of
  8. // single line comments.
  9. // Wowza
  10. if (items.length <= 1) return items;
  11. var pivot = items.shift(), current, left = [], right = [];
  12. /*
  13. This is a multiline comment block with
  14. an empty line inside of it.
  15. Awesome.
  16. */
  17. while(items.length > 0) {
  18. current = items.shift();
  19. current < pivot ? left.push(current) : right.push(current);
  20. }
  21. // This is a collection of
  22. // single line comments
  23. // ...with an empty line
  24. // among it, geez!
  25. return sort(left).concat(pivot).concat(sort(right));
  26. };
  27. // this is a single-line comment
  28. return sort(Array.apply(this, arguments));
  29. };