You are reading a single comment by @d0773d and its replies. Click here to read the full conversation.
  • I did:

    phValue = phValue.substring(0, phValue.length - 1);
    

    That code removes the last character as expected.

    In my previous forum post I explained that I attempted to catch the \r by doing:

    if (e.data != "\r" || e.data != "\n") {
          console.log("NO CR");
          phValue+=e.data;
        }
    

    However, "NO CR" is echoing out 5 times instead of only 4. I have no idea why \r is getting stored to the phValue when the if statement I think should of filtered \r out. Can anyone explain why this is happening?

About

Avatar for d0773d @d0773d started