rhino1.7.6.testsrc.tests.e4x.Statements.12.2.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhino Show documentation
Show all versions of rhino Show documentation
Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically
embedded into Java applications to provide scripting to end users.
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/. */
gTestfile = '12.2.js';
START("12.2 - For-in statement");
// All the employee names
e =
Joe
20
Sue
30
;
correct = new Array("Joe", "Sue", "Big Screen Television", "1299.99");
i = 0;
for (var n in e..name)
{
TEST("1."+i, String(i), n);
i++;
}
TEST("1.count", 2, i);
// Each child of the first item
order =
John Smith
-
Big Screen Television
1299.99
-
DVD Player
399.99
;
i = 0;
for (var child in order.item)
{
TEST("2."+i, String(i), child);
i++
}
TEST("2.count", 2, i);
i = 0;
for (var child in order.item[0].*)
{
TEST("3."+i, String(i), child);
i++
}
TEST("3.count", 2, i);
END();
© 2015 - 2024 Weber Informatics LLC | Privacy Policy