알고리즘 33 - Array plus array

jabae·2021년 10월 25일
0

알고리즘

목록 보기
33/97

Q.

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.

A)

function arrayPlusArray(arr1, arr2) {
  return arr1.reduce((sum, i)=> sum + i)+arr2.reduce((sum, i)=> sum + i)
}
profile
it's me!:)

0개의 댓글