rhino/testsrc/doctests/array.length.doctest
raw| 1 | // This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | // License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 | |
| 5 | js> function Array() { throw "don't call this" } |
| 6 | |
| 7 | js> [].length |
| 8 | 0 |
| 9 | js> [1].length |
| 10 | 1 |
| 11 | js> [,1,2].length |
| 12 | 3 |
| 13 | js> [1,,2].length |
| 14 | 3 |
| 15 | js> [1,2,].length |
| 16 | 2 |
| 17 | js> [,].length |
| 18 | 1 |
| 19 | js> [1,,].length |
| 20 | 2 |