Hacker News new | past | comments | ask | show | jobs | submit login

I may have discovered the worst correct answer:

    var foo = function (arr, i) {
      if (typeof arr === 'number') { 
        arr = new Array(arr);
        foo(arr, arr.length - 1);
        return arr;
      }
      if (i === -1) {
        return;
      }
      arr[i] = function () {
        return i;
      }
      foo(arr, i - 1);
    };



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: