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

    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