Javascript bitwise left shift operator (<)
This article mainly introduces the Javascript bitwise left shift operator (<) to convert the expression number to binary, and then to the bitwise information of the expression to the Left shift. For more information, see
Bitwise left shift operator (<)
Left shift expression bit.
Result = expression1 <expression2
Parameters
Result
Any variable.
Expression1
Any expression.
Expression2
Any expression.
Description
<Operator shifts all the bits of expression1 to the specified bits of expression2 to the left. For example:
Var temp
Temp = 14 <2
The value of the temp variable is 56, because 14 (that is, 00001110 of the binary) shifts to the left two places equal to 56 (that is, 00111000 of the binary ).
The bitwise left shift operator (<) in Javascript converts the expression number to a binary value, and then shifts the bitwise of the expression to the left.
Result = [number to be displaced] <[number of digits to be displaced]
The bitwise left shift operator (<) shifts the bit of the number to be shifted to the specified number of shifted digits. For example:
The Code is as follows:
Var temp;
Temp = 14 <2;
/*
The binary value of 14 is 00111000.
00001110 left displacement 2-digit 00111000 = 56
*/
Alert (temp );
// [56] is displayed]