• Custom User Avatar

    The regular expression should not use the g flag.

    Chai uses re.exec when it tests a regular expression re. This regular expression matches '000' and its lastIndex is set to 3 (because the g flag is set). The next test calls re.exec('110'). The match starts from the new lastIndex position and it fails.

  • Custom User Avatar

    There is something weird indeed with the tests, if you only leave that one in the sample tests, your code passes it. But, your code is not ok, and it returns true for any combination of 0 and 1 with 3 digits.

  • Custom User Avatar

    No, they are not identical:

                                    v
    expected 'Jacob and Alex like ths' 
    to equal 'Jacob and Alex like this'
                                    ^