Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Left Shift Assignment Operator (<<=) (JavaScript)

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.

result <<= expression
result

Any variable.

expression

The number of bits to move.

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

The following example shows how to use the <<= operator.

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

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.