String.prototype.includes.js 634 B

123456789101112131415161718
  1. load("test-common.js");
  2. try {
  3. assert(String.prototype.includes.length === 1);
  4. assert("hello friends".includes("hello") === true);
  5. assert("hello friends".includes("hello", 100) === false);
  6. assert("hello friends".includes("hello", -10) === true);
  7. assert("hello friends".includes("friends", 6) === true);
  8. assert("hello friends".includes("hello", 6) === false);
  9. assert("hello friends false".includes(false) === true);
  10. assert("hello 10 friends".includes(10) === true);
  11. assert("hello friends undefined".includes() === true);
  12. console.log("PASS");
  13. } catch (err) {
  14. console.log("FAIL: " + err);
  15. }