Higher Order Functions

some Answers Any

some Answers Any

some returns a boolean. It answers whether at least one item passes the callback test.

That makes it different from filter, which returns matching items. Use some when the program needs a yes-or-no answer, such as whether a warning should appear.

Your task: Use some to create hasUrgentTask from tasks. It should be true when at least one task has urgent: true.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

some Answers Any

some returns a boolean. It answers whether at least one item passes the callback test.

That makes it different from filter, which returns matching items. Use some when the program needs a yes-or-no answer, such as whether a warning should appear.

Your task: Use some to create hasUrgentTask from tasks. It should be true when at least one task has urgent: true.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.