repl.it
@MNouri/

Min and Max array

Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
function minMax(arr){
  //Math.max function will get max num
  var maxNum = Math.max(...arr);
  //Math.min will get min num
  var minNum = Math.min(...arr);

  var array = [minNum, maxNum];

  console.log(array);
}


minMax([5, 7,10, 45, 23123]);