Richest Customer Wealth in Javascript.

leetCode problem : leetcode.com/problems/richest-customer-wealth

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ​​​​​​​​​ith​​​​ customer has in the ​​​​​jth​​​​ bank. Return the wealth that the richest customer has.

A customer’s wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth.

solutions :--

var maximumWealth = accounts => {
let maximumWealthCustomer = 0;
for(let i = 0; i < accounts.length; i++) {
let individualCustomerWealth = 0;
for(let j = 0; j < accounts[i].length; j++) {
individualCustomerWealth += accounts[i][j]
}
maximumWealthCustomer = Math.max(maximumWealthCustomer, individualCustomerWealth);
}
return maximumWealthCustomer
};

const accounts1 = [[1,5],[7,3],[3,5]]
const accounts2 = [[1,5],[7,3],[3,5]]

console.log(maximumWealth(accounts1));
console.log(maximumWealth(accounts2));