[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Math/min [Back]  [Original]

Math.min() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Math.min()

Baseline

20157

Math.min() Infinity

console.log(Math.min(2, 3, 1));
// : 1

console.log(Math.min(-2, -3, -1));
// : -3

const array = [2, 3, 1];

console.log(Math.min(...array));
// : 1

js
Math.min()
Math.min(value1)
Math.min(value1, value2)
Math.min(value1, value2, /* , */ valueN)

value1, , valueN

0

1 NaN Infinity

min() Math Math.min() Math (Math )

Math.min.length 2 2

Math.min()

x y z

js
const x = 10;
const y = -20;
const z = Math.min(x, y); // -20

Math.min()

Math.min()

js
let x = f(foo);

if (x > boundary) {
  x = boundary;
}

js
const x = Math.min(f(foo), boundary);

Math.max()

ECMAScript 2027 LanguageSpecification
# sec-math.min


Web Proxy Viewer  |  New URL  |  Original Page