const sumNums = (arr)=>{
let sum=0;
for (let t = 0; t < arr.length; t++) {
if(typeof arr[t] == "number" ){
sum = sum + arr[t] ;
}
}
return sum;
}
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
function addSum(array) { // call the function with your array parameter
let solution = 0
for (let x = 0 ; x < array.length;x++) { // for loop
solution = solution + array[x]
}
return solution
}
// If you do not want to use array.reduece you can itereate through the array and then get the solution.
const getSum = (arr)=>{
let sum = 0;
for(key of arr){
sum += key
}
return sum
}
// sum of all number
function sum(){
let InValue =0
for (let index = 0; index < arguments.length; index++) {
InValue +=arguments[index];
}
console.log(`Total sum of all number is = ${InValue} `);
}
sum(10,10,10);