Math Maximum in JavaScript

Level 128 keystrokes

Uses Math.max() to print the larger of 3 and 7, which is 7.

JavaScript code

// Math.max() returns the largest of its arguments, here 7
// It accepts any number of arguments, e.g. Math.max(1, 9, 4) returns 9
1console.log(Math.max(3, 7));

Output

7
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