/js/src/jit-test/tests/basic/newTest.js

http://github.com/zpao/v8monkey · JavaScript · 14 lines · 13 code · 1 blank · 0 comment · 1 complexity · 8b31cc29e594b034feb32def436b916a MD5 · raw file

  1. function MyConstructor(i)
  2. {
  3. this.i = i;
  4. }
  5. MyConstructor.prototype.toString = function() {return this.i + ""};
  6. function newTest()
  7. {
  8. var a = [];
  9. for (var i = 0; i < 10; i++)
  10. a[i] = new MyConstructor(i);
  11. return a.join("");
  12. }
  13. assertEq(newTest(), "0123456789");