JavaScript - Why is output [2,4]? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

JavaScript - Why is output [2,4]?

var c = new Array(1,2,3,4); var b = c.filter(function(a){ return(a%2-1); }); document.write(b);

14th Oct 2019, 12:17 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
2 Answers
14th Oct 2019, 1:24 PM
ODLNT
ODLNT - avatar
+ 2
WONDERFUL answer!
14th Oct 2019, 5:11 PM
Paolo De Nictolis
Paolo De Nictolis - avatar