Javascript bitwise left-shift operator (<<)

Source: Internet
Author: User
Tags bitwise expression

This article mainly describes the JavaScript bitwise LEFT operator (<<) to convert the expression number to binary, and then left the expression of the bit of the relevant information, the need for friends can refer to the

The bitwise Left operator (<<) shifts the bit of the expression to the left.   result = expression1 << expression2 parameter result any variable.   Expression1 of any expression.   Expression2 of any expression. The description << operator shifts all bits of expression1 to the left expression2 the specified number of digits.    For example, the value of temp temp = << 2 variable is 56, because 14 (that is, binary 00001110) shifts to the left two digits to 56 (that is, binary 00111000).   The Javascript bitwise Left operator (<<) converts an expression number to binary, and then shifts the bits of the expression to the left. result = "number to be shifted" << "displacement digit" bitwise Left operator (<<) shifts the bit of "number to be shifted" to the left of the number of digits specified in "offset digits". For example: The code is as follows: Var temp; temp = << 2; /* 14 binary is 00111000 00001110 left-shift 2-bit 00111000 = +/alert (temp); Pop-up "56"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.