https://www.codewars.com/kata/5a2be17aee1aaefe2a000151
Codewars - Achieve mastery through coding practice and developer mentorship
A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!
www.codewars.com
DESCRIPTION:
I'm new to coding and now I want to get the sum of two arrays... Actually the sum of all their elements. I'll appreciate for your help.
P.S. Each array includes only integer numbers. Output is a number too.
코드
function arrayPlusArray(arr1, arr2) {
return arr1.concat(arr2).reduce((a, b) => a + b, 0);
}
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Count by X (8 kyu) / JavaScript (0) | 2023.02.23 |
---|---|
[Codewars] Get the mean of an array (8 kyu) / JavaScript (0) | 2023.02.22 |
[Codewars] Rock Paper Scissors! (8 kyu) / JavaScript (0) | 2023.02.20 |
[Codewars] Total amount of points (8 kyu) / JavaScript (0) | 2023.02.19 |
[Codewars] Count the Monkeys! (8 kyu) / JavaScript (0) | 2023.02.18 |
댓글