0

How to eliminate string from the array

suppose you have a array that contain numbers and strings. write a function that skip tje strings from the array and sum up all the numbers in an array

16th Apr 2018, 3:26 PM
Sharry Brar
6 Respostas
+ 3
arr=[8,3,"hello",3]; sum=0; arr.forEach(v=> { if(typeof v=="number") { sum+=v; }}); console.log(sum);
16th Apr 2018, 4:14 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
bro make it little difficult. do it without built-in function
16th Apr 2018, 4:15 PM
Sharry Brar
+ 1
i mean write function without any built in function. like donot use typeof function
16th Apr 2018, 5:13 PM
Sharry Brar
+ 1
i mean donot use any built in function
16th Apr 2018, 5:36 PM
Sharry Brar
0
JavaScript
16th Apr 2018, 3:42 PM
Sharry Brar
0
thq dude
16th Apr 2018, 4:14 PM
Sharry Brar