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

## Description

In JavaScript, imul() is a feature (“integer multiplication”) that is used to function 32-bit integer multiplication of two values and return the result. Because the imul() characteristic is a static feature of the Math object, it must be invoked through the placeholder object referred to as Math.

## Syntax

In JavaScript, the syntax for the imul() function is:

`Math.imul(number1, number2);`

Parameters or Arguments

number1 The first range to multiply. number2 The 2d quantity to multiply.

## Returns

The imul() feature returns the result of two values that are improved together the usage of 32-bit multiplication.

## Note

Math is a placeholder object that incorporates mathematical functions and constants of which imul() is one of these functions.

## Example

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

For example:

```
console.log(Math.imul(2, 5));
console.log(Math.imul(-18, 6));
```

In this example, we have invoked the imul() function using the Math class.

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

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

```
10
-108
```

In this example, the first output to the console log returned 10 which is the result of two extended by 5 the usage of 32-bit multiplication.

The 2d output to the console log back -108 which is the result of -18 extended by way of 6 the usage of 32-bit multiplication.

## Leave a Review