LibJS: Add String.prototype.indexOf()

This commit is contained in:
Andreas Kling 2020-04-04 23:44:29 +02:00
commit 97cd1173fa
Notes: sideshowbarker 2024-07-19 07:55:31 +09:00
3 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,12 @@
function assert(x) { if (!x) throw 1; }
try {
var s = "hello friends"
assert(s.indexOf("friends") === 6);
assert(s.indexOf("enemies") === -1);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}