JavaScript clz32() method
- Föregående sida ceil()
- Nästa sida cos()
- Åter till föregående nivå JavaScript Math referenshandbok
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 |
Webbläsarsupport
Metoder | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
clz32() | 38.0 | 12.0 | 31.0 | 7.0 | 25.0 |
Relaterade sidor
Lärobok:JavaScript matematik
- Föregående sida ceil()
- Nästa sida cos()
- Åter till föregående nivå JavaScript Math referenshandbok