diff --git a/src/map_function.js b/src/map_function.js new file mode 100644 index 0000000..38686a2 --- /dev/null +++ b/src/map_function.js @@ -0,0 +1,12 @@ +// By using map function you can iterate to an array and apply some filter to it. +// Map function receives a callback function. +// Will return only if the number is even. + +var arr = [1,5,4,8,11]; + +var printed =arr.map(item=>{ + if(item%2==0) {return item}; + }); + + console.log(printed); +