Skip to content
Aabha AI Academy
Skip to reading

JavaScript

Exercise 05: Select event records

Use a copy of examples/05.

A. Explain

What does events[0].id read? What does find return for an ID that is not present? What happens if you immediately access .title on that missing result?

B. Repair

A filter callback with braces evaluates event.places > 0 but forgets return. Repair it. Confirm that repair-cafe is excluded while two other records remain.

C. Transfer

Write a function returning the titles of available creative events. For the supplied three records the result is ["Story circle"]. Show what happens if the input array is empty. Do not mutate the original records.

Evidence

A source function and three checks: supplied data, empty array, and a creative event with zero places.

Return to lesson · Explained answer

Download this source file