mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
LibJS: Implement indexed access for StringObject
This commit is contained in:
parent
a81bce8c2a
commit
1ba2e6768d
2 changed files with 27 additions and 0 deletions
19
Libraries/LibJS/Tests/indexed-access-string-object.js
Normal file
19
Libraries/LibJS/Tests/indexed-access-string-object.js
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue