How do I change this arrow function to normal funcion šŸ™† | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

How do I change this arrow function to normal funcion šŸ™†

const printOdds = (arr) => { arr.forEach (el=>{ if (el % 2 != 0) console.log (el); }); }

23rd Oct 2019, 2:21 PM
Amwata Aseda šŸ‡°šŸ‡Ŗ
Amwata Aseda šŸ‡°šŸ‡Ŗ - avatar
6 Respostas
+ 5
Why you wanted to do this? function printOdds(arr) { arr.forEach (function(el) { if (el % 2) console.log (el); }); } a = [10, 23,30,47, 50]; printOdds(a);
23rd Oct 2019, 4:43 PM
Ipang
+ 3
Oh yea thought it a bug at firstšŸ˜ƒ
23rd Oct 2019, 5:58 PM
Amwata Aseda šŸ‡°šŸ‡Ŗ
Amwata Aseda šŸ‡°šŸ‡Ŗ - avatar
+ 2
Thanks Ipang šŸ‘ Been writing codes with an older machine.
23rd Oct 2019, 5:43 PM
Amwata Aseda šŸ‡°šŸ‡Ŗ
Amwata Aseda šŸ‡°šŸ‡Ŗ - avatar
+ 2
Please note forEach wonā€™t work on older version for defined browser. https://caniuse.com/#search=forEach
21st Mar 2020, 12:11 PM
\ā€¢/
\ā€¢/ - avatar
+ 1
I was told these new standards works if we use updated browser, does it work for you, updated browser?
23rd Oct 2019, 5:47 PM
Ipang
0
eodejdijeijed
15th Mar 2022, 2:34 PM
Mahmoud Elhaj
Mahmoud Elhaj - avatar