Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    right if essentially returning what you are evaluating, returning the expression should suffice.
    would love to hear from others regarding this.

  • Custom User Avatar

    @preste101 array is not falsy, null is.
    in your console. you will see evaluated as such.. array evaluated as true, null as false.

    thus my my comment, case. execute the these expressions below seperately.

    '(703) 555-5555'.match(new RegExp('^\\([0-9]{3}\\)\\s[0-9]{3}-[0-9]{4}$', "gim")) && console.log('true');

    '7035555555'.match(new RegExp('^\\([0-9]{3}\\)\\s[0-9]{3}-[0-9]{4}$', "gim")) || console.log('false');

  • Custom User Avatar

    I agree. I only test positive values (or zero), as negative values do not make sense as a quantity of something, and so cannot have a "plurality". I've added a note to the description to this effect.

  • Custom User Avatar

    I'm not sure I understand what you mean here... The solution you provided works as expected, and the tests are all correct as far as I can see. If the tests fail, they should print the error message along with the expected and received values that are not matching.

    Could you tell me what you think the correct answers should be for each test?, please?

  • Default User Avatar

    thanks, jsdev... I guess I just don't understand what Test Fixtures is about at all.

  • Custom User Avatar

    what sounds better? "-1 car" or "-1 cars". I think the latter.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    this is a heads up for everyone I see this a lot... anywhere you have "? true : false" you can omit it... as it's redundant

    case in point: return phoneNumber.match(new RegExp('^\([0-9]{3}\)\s[0-9]{3}-[0-9]{4}$', "gim")) // will return true or false...

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution