www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] What are these JavaScript operators? "<<", "|", "&"

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    42

    resolved [RESOLVED] What are these JavaScript operators? "<<", "|", "&"

    Ran across some code on Stack Overflow today that had me stumped. This is a few lines from the code.

    Code:
    var enc1 = chr1 >> 2;
    var enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
    var enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
    
    string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
    string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
    I've been playing with these operators in the console and a pattern appears to be there but its not quite clear.
    Can someone point me to an article or give me a term for these operators so I can look them up? Thanks!

  2. #2
    Join Date
    May 2010
    Posts
    42
    Never mind, another 3 minutes of Googling got it for me. They're called Bitwise operators for anyone interested, here's an article on them: http://en.wikibooks.org/wiki/JavaScr...wise_Operators

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles