Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

done #235

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

done #235

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
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
function find(array, callback) {
for (let element of array) {
// Write your code here.
if (callback(element)) {
return element;
}
}
return undefined
}

/**
Expand All @@ -36,6 +40,9 @@ function filter(array, callback) {
const result = [];
for (let element of array) {
// Write your code here.
if(callback(element)){
result.push(element);
}
}
return result;
}
Expand All @@ -58,6 +65,7 @@ function map(array, callback) {
const result = [];
for (let element of array) {
// Write your code here.
result.push(callback(element))
}
return result;
}
Expand All @@ -78,6 +86,7 @@ function map(array, callback) {
function forEach(array, callback) {
for (let i = 0; i < array.length; i++) {
// Write your code here.
callback(array[i],i,array)
}
}

Expand Down