findMax = a => a.reduce((x, y) => x > y ? x : y, -Infinity)
findMax = a => Math.max(...a)- findMax = a => a.reduce((x, y) => x > y ? x : y, -Infinity)
Test.assertEquals(findMax([1, 2, 3, 4, 5]), 5) Test.assertEquals(findMax([1, 2, 3, -4, 5]), 5) Test.assertEquals(findMax([-1, -2, -3, -4, -5]), -1)
Test.assertEquals(findMax([1, 2, 3, 4, 5]), 5)- Test.assertEquals(findMax([1, 2, 3, 4, 5]), 5)
- Test.assertEquals(findMax([1, 2, 3, -4, 5]), 5)
- Test.assertEquals(findMax([-1, -2, -3, -4, -5]), -1)