News for hackers. Stuff that matters.
Re:Stack Overflow: Printing 1 to 1000 in C by Tomek_ on Tuesday March 15, 2011 @11:10AM (#2327809)
Javascript, validity depends on how exactly do you define conditions and loops:

  var items = [];
  var rec = function(item) {
      var func = [];
      func[true] = function(item) { items.push(item); [item-1].map(rec); };
      func[false] = function(item) {};
      return func[Boolean(item)](item);
  };
  var item = [1000];
  item.map(rec);
  console.log(items.reverse().join(','));
Won't do in browsers due to recurssion limit but change [1000] to [10] and you'll see it works.

There are no comments on this comment yet.