JS Built-ins
← Math131 / 215
Mathimulbeginner

Math.imul() β€” Basic Multiplication

πŸ“– Usage Example
// 32-bit integer multiplication (C-like overflow)
Math.imul(3, 4)    // β†’ 12
Math.imul(-1, 8)   // β†’ -8

Use Math.imul() for fast 32-bit integer multiplication with C-like overflow semantics, useful in hashing or WebAssembly.

Math.imul()

Performs C-like 32-bit integer multiplication.

Challenge: Use Math.imul(3, 4) and verify the result is 12.

πŸ’‘ Hints (1)
  • β€’ Math.imul performs 32-bit integer multiplication, same as * for small integers