Ad
  • Default User Avatar

    Test functions for javascript:

    // TODO: Add your tests here
    // Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.
    // [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)
    // are still available for now.
    //
    // For new tests, using [Chai](https://chaijs.com/) is recommended.
    // You can use it by requiring:
    //     const assert = require("chai").assert;
    // If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.
    
    describe("Solution", () => {
      it("should test for something", () => {
        Test.assertDeepEquals(anagrams("abba", ["aabb", "abcd", "bbaa", "dada"]), [
          "aabb",
          "bbaa",
        ]);
      });
    
      it("should test for something", () => {
        Test.assertDeepEquals(
          anagrams("racer", ["crazer", "carer", "racar", "caers", "racer"]),
          ["carer", "racer"]
        );
      });
    
      it("should test for something", () => {
        Test.assertDeepEquals(anagrams("laser", ["lazing", "lazy", "lacer"]), []);
      });
    });
    
  • Custom User Avatar

    You're all mutating the array it seems.

  • Custom User Avatar

    You're right, it is the same error for me

  • Custom User Avatar

    I figured out the same issue, in C#

  • Custom User Avatar
  • Custom User Avatar

    It should not happen.