Array Problem Set
-
printReverse():
-
Take an array and print out the elements of the array in reverse order. Do not modify the original array.
- printReverse([1,2,3,4]) -> 4, 3, 2, 1
- printReverse(["a","b","c"]) -> "c", "b", "a"
-
isUniform():
-
Take an array and return true if all elements in the array are identical.
- isUniform([1,1,1,1]) -> true
- isUniform([2,1,1,1]) -> false
- isUniform(["a","b","p"]) -> false
- isUniform(["b","b","b"]) -> true
-
sumArray():
-
Take an array (of only numbers) and return the sum of the array.
- sumArray([1,2,3]) -> 6
- sumArray([10,3,10,4]) -> 27
- sumArray([-5,100]) -> 95
-
max():
-
Take an array (of only numbers) and return the largest number in the array.
- max([1,2,3]) -> 3
- max([10,3,10,4]) -> 10
- max([-5,100]) -> 100