MCPcopy Create free account
hub / github.com/CleverProgrammers/JavaScript-Course-by-Clever-Programmer- / max

Function max

playground.js:270–281  ·  view source on GitHub ↗
(numbers)

Source from the content-addressed store, hash-verified

268// sum up all numbers in array
269
270const max = (numbers) => {
271 let result = numbers[0]
272
273 // loop
274 for (const number of numbers) {
275 if (number > result) {
276 result = number
277 }
278 }
279
280 return { result }
281}
282
283// console.log(max([1, 2, 3, 4, 5]))
284

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected