File: 480758.doctest

package info (click to toggle)
htmlunit-core-js 2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 5,804 kB
  • ctags: 10,088
  • sloc: java: 75,059; xml: 889; sh: 14; makefile: 11
file content (17 lines) | stat: -rwxr-xr-x 411 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
js> function primBeget(proto) {
  >   if (proto === null) { fail("Cannot beget from null."); }
  >   if (proto === (void 0)) { fail("Cannot beget from undefined."); }
  >   function F() {}
  >   F.prototype = proto;
  >   var result = new F();
  >   return result;
  > }
js> var x = [1].concat(primBeget(Array.prototype));
js> x
1,
js> x[1]

js> typeof x[1]
object
js> x[1] instanceof Array
true