# Using Math clz32() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math feature known as clz32() with syntax and examples.

## Description

In JavaScript, clz32() is a characteristic (acronym for “Count Leading Zeros 32”) that is used to return the wide variety of main zeros in a 32-bit binary illustration of a number. Because the clz32() function is a static feature of the Math object, it ought to be invoked through the placeholder object referred to as Math.

## Syntax

In JavaScript, the syntax for the clz32() characteristic is:

``Math.clz32(number);``

Parameters or Arguments

number The range which will be converted to a 32-bit binary number and then its main zero bits will be counted.

## Returns

The clz32() feature returns the range of main zeros in a number represented as 32-bit binary.

## Note

Math is a placeholder object that consists of mathematical features and constants of which clz32() is one of these functions.

## Example

Let’s take a seem to be at an example of how to use the clz32() function in JavaScript.

For example:

``````console.log(Math.clz32(1));
console.log(Math.clz32(2));
console.log(Math.clz32(4));``````

In this example, we have invoked the clz32() function the use of the Math class.

We have written the output of the clz32() feature to the net browser console log, for demonstration purposes, to exhibit what the clz32() feature returns.

The following will be output to the net browser console log:

``````31
30
29``````

In this example, the first output to the console log back 31 considering the fact that there are 31 leadings zeros in the 32-bit binary representation of the number 1 which is 00000000000000000000000000000001.

The 2d output to the console log back 30 for the reason that there are 30 leadings zeros in the 32-bit binary illustration of the wide variety 2 which is 00000000000000000000000000000010.

The 1/3 output to the console log lower back 29 considering there are 29 leadings zeros in the 32-bit binary representation of the number 4 which is one hundred