Minimum Value in JavaScript

Level 128 keystrokes

Uses Math.min() to print the smaller of 5 and 2, which is 2.

JavaScript code

// Math.min() returns the smallest of its arguments, here 2
// The order of the arguments does not matter: Math.min(2, 5) is also 2
1console.log(Math.min(5, 2));

Output

2
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this JavaScript code and how often they appear.

  • .× 2
  • (× 2
  • )× 2
  • ,× 1
  • ;× 1

More JavaScript examples at level 1

← JavaScript typing practice