forked from M3-Academy/challenge-algorithms-v2.0
15 lines
415 B
JavaScript
15 lines
415 B
JavaScript
export function sum(values) {
|
|
// implementar logica aqui
|
|
if (toString.call(values) !== "[object Array]")
|
|
return false;
|
|
|
|
var total = 0;
|
|
for(var i=0;i<values.length;i++)
|
|
{
|
|
if(isNaN(values[i])){
|
|
continue;
|
|
}
|
|
total += Number(values[i]);
|
|
}
|
|
return total;
|
|
} |