Smaller of two values
Compare two values and return the smaller one.
Math.min
Simple example
Start3 · 7
Result3
console.log(Math.min(3, 7));
3
Advertisements
Everyday examples
Two buses charge 8 and 5 for the same trip. Which fare is cheaper?
Start8 · 5
Result5
console.log(Math.min(8, 5));
5
A child wants 5 stickers. You have 3 left. How many can you give them?
Start5 · 3
Result3
console.log(Math.min(5, 3));
3
Two walks to school take 12 and 9 minutes. How long is the quicker walk?
Start12 · 9
Result9
console.log(Math.min(12, 9));
9
If both values are equal, the answer is that same value.