Maximum Number In Array Leetcode Problems Javascript Foreach Element