25 lines
473 B
JavaScript
25 lines
473 B
JavaScript
// METHODS OF ARRAYS
|
|
/*
|
|
push(elem_list): Adds one or more elements to the end of the array,
|
|
and returns the new length of the array.
|
|
*/
|
|
let getSum = function(list)
|
|
{
|
|
let sum=0
|
|
for(let i in list)
|
|
{
|
|
let n = list[i]
|
|
sum = sum + n
|
|
}
|
|
return sum;
|
|
}
|
|
|
|
let numbers = [2, 6, 4, 7, 3, 6]
|
|
|
|
let min = Math.min.apply(null, numbers)
|
|
let max = Math.max.apply(null, numbers)
|
|
|
|
console.log("Min = " +min)
|
|
console.log("Max = " +max)
|
|
|