All Downloads are FREE. Search and download functionalities are using the official Maven repository.

testsrc.doctests.array.dense.doctest Maven / Gradle / Ivy

Go to download

A distribution of rhino which releases snapshots from a submodule folder containing forked sources.

The newest version!
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

// test various array methods with dense arrays
js> var x = []

js> x[10] = 1
1
js> x.length
11
js> 0 in x
false
js> x.shift()
js> x.length
10
js> 0 in x
false
js> x
,,,,,,,,,1
js> x.reverse()
1,,,,,,,,,
js> x.length
10
js> 9 in x
false
js> x.reverse()
,,,,,,,,,1
js> x.length
10
js> 5 in x
false
js> x.unshift(2)
11
js> x
2,,,,,,,,,,1
js> 9 in x
false
js> var r = x.splice(3, 4, 3, 4, 5)
js> r
,,,
js> r.length
4
js> 2 in r
false
js> x.length
10
js> x
2,,,3,4,5,,,,1
js> x[5]
5
js> 8 in x
false
js> var s = x.slice(6, 8);
js> s
,
js> s.length
2
js> 1 in s
false
js> var y = []
js> y[9] = 1
1
js> var z = y.concat(x)
js> z
,,,,,,,,,1,2,,,3,4,5,,,,1
js> z.length
20
js> 2 in z
false
js> 12 in z
false





© 2015 - 2024 Weber Informatics LLC | Privacy Policy