AI-generated Key Takeaways
-
The
Number.leftShiftmethod calculates the left shift of a number by a specified number of bits. -
It takes two number arguments, the left-hand value to be shifted and the right-hand value specifying the number of bits to shift.
-
The method returns a number representing the result of the left shift operation.
| Usage | Returns |
|---|---|
Number.leftShift(right) | Number |
| Argument | Type | Details |
|---|---|---|
this: left | Number | The left-hand value. |
right | Number | The right-hand value. |
Examples
Code Editor (JavaScript)
/** * Unsigned 8-bit type example. * * 20 as binary: 00010100 * Left shift 2: 01010000 * * 01010000 is binary for 80. */ print(ee.Number(20).leftShift(2)); // 80
import ee import geemap.core as geemap
Colab (Python)
"""Unsigned 8-bit type example. 20 as binary: 00010100 Left shift 2: 01010000 01010000 is binary for 80. """ print(ee.Number(20).leftShift(2).getInfo()) # 80