Files
AP-Computer-Principles-Archive/arrays/Example5.js
2025-10-27 12:26:06 -05:00

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)