it seems this only work on “even” numbers:
"8"|0 + 1 // 9
"3"|0 + 1 // 3
("3"|0) + 1 // 4
but "3"|0 translates to the Integer 3.
so what’s going on here?
why does the second example acts like this in JS?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The precedence of + is higher than |.
So it’s parsing like this: