알고리즘 49 - Sum Mixed Array

jabae·2021년 10월 29일
0

알고리즘

목록 보기
49/97

Q.

Given an array of integers as strings and numbers, return the sum of the array values as if all were numbers.

Return your answer as a number.

A)

function sumMix(x){
  return x.map(el => Number(el)).reduce((sum, cur) => sum + cur)
}
profile
it's me!:)

0개의 댓글