LibJS: Implement indexed access for StringObject

This commit is contained in:
Linus Groh 2020-05-01 13:20:47 +01:00 committed by Andreas Kling
commit 1ba2e6768d
Notes: sideshowbarker 2024-07-19 07:08:18 +09:00
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,19 @@
load("test-common.js");
try {
var s = "foo";
assert(s[0] === "f");
assert(s[1] === "o");
assert(s[2] === "o");
assert(s[3] === undefined);
var o = new String("bar");
assert(o[0] === "b");
assert(o[1] === "a");
assert(o[2] === "r");
assert(o[3] === undefined);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}