Jump to content
Sign in to follow this  
jamesadrian

XOR in Java Script

Recommended Posts

I am about to put a full effort into learning javascript, but there are certain features I cannot live without. One of them isthe XOR operation. I have read some comments about it online and I have looked for it int eh W3Schoold tutorial. I understand that ^ is the operator, but I am confused about how it works.

 

If I have two byte values A and B, will C be what I expect?

 

A ^ B = C

 

Thank you for your help.

 

Jim Adrian

Share this post


Link to post
Share on other sites

It does an XOR operation on the bits of A and B, they must be integers. If they aren't they'll be casted to integer.

Share this post


Link to post
Share on other sites

It is not 100% complete. I usually check the MDN (Mozilla Developer Network) for more detailed information.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...