- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# What is the use of Math.clz32() method in JavaScript?

**Math.clz32()**

The **Math.clz32()** function returns the number of **leading zero bits** in the **32-bit binary** representation of a number. In a binary representation, there are 32 numbers consisting of only 1's and 0's. This method scrutinizes through each and every element and returns the number of 0's.

### syntax

Math.clz32(number);

### Example-1

In the following example, numbers 1 and 0 were passed into the **Math.Clz32()** function and the number of trailing zeroes were displayed in the output.

<html> <body> <script> document.write(Math.clz32(1)); document.write("</br>"); document.write(Math.clz32(0)); </script> </body> </html>

### Output

31 32

### Example-2

In the following example, numbers 21 and 20 were passed into the** Math.Clz32()** function and the number of trailing zeroes(27, 27) were displayed in the output.

<html> <body> <script> document.write(Math.clz32(21)); document.write("</br>") document.write(Math.clz32(20)) </script> </body> </html>

### Output

27 27

- Related Questions & Answers
- What is math object in JavaScript?
- What is the use of forEach() method in JavaScript?
- What is the use of Array.Reduce() method in JavaScript?
- What is the use of Array.Some() method in JavaScript?
- What is the use of Array.Find() method in JavaScript?
- What is the use of Array.findIndex() method in JavaScript?
- What is the use of Math.abs() method in JavaScript?
- What is the use of Math.pow() method in JavaScript?
- What is the use of substr() method in JavaScript?
- what is the use of slice() method in JavaScript?
- What is the use of Array.entries() method in JavaScript?
- What is the use of charAt() method in JavaScript?
- What is the use of _.size() method in JavaScript?
- What is the use of weakSet.has() method in JavaScript?
- What is the use of Object.is() method in JavaScript?

Advertisements