Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function multy(arr) {
- let result = 0;
- for (var j = 0; j < arr.length; j++) {
- result += arr[j][0] * arr[j][1];
- }
- return result;
- }
- const arr = [[5, 6], [2, 3], [1, 2]];
- console.log(multy(arr));
- //or more cool
- function multy(arr) {
- let result = 0;
- arr.map(arr => {
- result += arr[0] * arr[1]
- });
- return result;
- }
- const arr = [[5, 6], [2, 3], [1, 2]];
- console.log(multy(arr));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement