Array.prototype.join.js 530 B

123456789101112131415161718
  1. load("test-common.js");
  2. try {
  3. assert(Array.prototype.join.length === 1);
  4. assert(["hello", "friends"].join() === "hello,friends");
  5. assert(["hello", "friends"].join(" ") === "hello friends");
  6. assert([].join() === "");
  7. assert([null].join() === "");
  8. assert([undefined].join() === "");
  9. assert([undefined, null, ""].join() === ",,");
  10. assert([1, null, 2, undefined, 3].join() === "1,,2,,3");
  11. assert(Array(3).join() === ",,");
  12. console.log("PASS");
  13. } catch (e) {
  14. console.log("FAIL: " + e);
  15. }