Thursday, April 9, 2015

JavaScript (-1)*0

JavaScript implemented in Chrome and in Nodejs should give the same results? Lets try multiply (-1) and 0:
Chrome:

Nodejs:

4 comments:

  1. That's fun! On what occasion did you spot it?

    Do you think it makes any practical difference? :)

    (stupid blogspot double postings ;/)

    ReplyDelete
    Replies
    1. It was quite funny - during interview candidate have told me about (-1)*0 = -0 Just after interview I want to check this funny "fact". Terminal was open so I try this in nodejs. Myth was busted and I share this news with second interviewer. My second thought was to check this in chrome console and myth defend itself. I didn't share this news with second interviewer, but I hope he will read this blogpost.

      Delete
    2. I think the interviewee would not be happy to know that his chances of getting a job are affected by the other interviewer's reading of your blog xD

      Delete
    3. JS was out of scope so we do not care about this topic. It was just cool story.

      Delete