Ad
  • Custom User Avatar

    you are trying to split a variable that is undefined or is == ''.
    you have to handle those cases before you try to split or you will get that error.

  • Custom User Avatar

    Not only can I bend code with the power of my mind, but I can also "remotely view" it from dozens of inches away. ;-)

  • Custom User Avatar

    It also counts some invalid faces if you fix the nose problem.

  • Custom User Avatar

    Your solution doesn't account for smileys with a nose, so for example if you got [';-D'] as input, your solution returns 0 but it should be 1.

  • Custom User Avatar

    Two problems:

    • ...zlet !== 'A'|'B'|'C'|'D'|'E'|'F'|'G'|'H'|'K'... The | performs a bit-wise OR. In JavaScript, performing it on strings returns 0. So you're comparing a string to numeric zero.

    • ...zlet === "A" || "B" || "C"... The || performs a logical OR. In JavaScript, a null string is false and all other strings are true. So this expression evaluates as zlet === true OR true OR true. Of course, zlet is a string not a boolean.

    You need to rethink those four lines. I tested your code with the conditionals corrected and it works fine.

    BTW, you should submit your questions labeled as Question so that folks will more be likely to respond.