This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

left shift assignment

Summary

Moves the specified number of bits to the left and assigns the result to result. The bits vacated by the operation are filled with 0.

Syntax

result <<= expression
result
Any variable.
expression
The number of bits to move.

Examples

Using the <<= operator is the same as specifying result = result << expression

// 14 is 00000000000000000000000000001110
var temp = 14;
temp <<= 2;
document.write(temp);
// 56 is 00000000000000000000000000111000
Output: 56

See also

Other articles

Attributions

  • Microsoft Developer Network: Article