Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/map_function.js
Original file line number Diff line number Diff line change
@@ -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);