<<<<<<< HEAD Code Wars - Brett Crafton

Array plus array

Question

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.

No examples

Solution by -

My Solution


	function arrayPlusArray(arr1, arr2) {
		return arr1.reduce((a,b) => a +b, 0) + arr2.reduce((a,b) => a +b, 0); //something went wrong
		}
				

Try it yourself - CodeWars

======= Code Wars - Brett Crafton

Array plus array

Question

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.

No examples

Solution by -

My Solution


	function arrayPlusArray(arr1, arr2) {
		return arr1.reduce((a,b) => a +b, 0) + arr2.reduce((a,b) => a +b, 0); //something went wrong
		}
				

Try it yourself - CodeWars

>>>>>>> 0e614172debaa009c8d31330edbeb3b765b59c39