JavaScript clz32() method
- Forrige side ceil()
- Næste side cos()
- Gå tilbage til niveau JavaScript Math Reference Håndbog
Definition and usage
clz32()
The method is an abbreviation of CountLeadingZeroes32, which returns the number of leading zeros in the 32-bit binary representation of a number.
Example
Returns the number of leading zeros in the 32-bit binary representation of different numbers:
var a = Math.clz32(0); var b = Math.clz32(1); var c = Math.clz32(2); var d = Math.clz32(4);
Syntax
Math.clz32(x)
Parameter value
Parameter | Description |
---|---|
x | Required. Number. |
Technical details
Return value: |
The number of leading zeros in the 32-bit binary representation of the number. If the number is 0, this method returns 32 (because all bits are 0). |
---|---|
JavaScript version: | ECMAScript 2015 |
Browserunderstøttelse
Metoder | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
clz32() | 38.0 | 12.0 | 31.0 | 7.0 | 25.0 |
Relaterede sider
Tilførsel:JavaScript matematik
- Forrige side ceil()
- Næste side cos()
- Gå tilbage til niveau JavaScript Math Reference Håndbog