Getting maximum and minimum

suggest change

The Math.max() function returns the largest of zero or more numbers.

Math.max(4, 12);   //  12
Math.max(-1, -15); // -1

The Math.min() function returns the smallest of zero or more numbers.

Math.min(4, 12);   //  4
Math.min(-1, -15); // -15

Getting maximum and minimum from an array:

var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9],
    max = Math.max.apply(Math, arr),
    min = Math.min.apply(Math, arr);

console.log(max); // Logs: 9
console.log(min); // Logs: 1

ECMAScript 6 spread operator, getting the maximum and minimum of an array:

var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9],
    max = Math.max(...arr),
    min = Math.min(...arr);

console.log(max); // Logs: 9
console.log(min); // Logs: 1

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Arithmetic Math:
* Getting maximum and minimum

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
18 Arithmetic Math
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
64 Console
68 Symbols
73 Modals
76 Events
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde