Ad

Description

Given a array of integer, find and return its maximum number.

Constraints

Rules

  • Do not use prehensive javascript function like Number.max
export function maxNumber(arr: number[]): number {
  let max = 0;
  
  for (let item of arr) {
    if (item > max) { max = item; }
  }
  
  return max;
}