Arrays and objects

Return an array of titles whose read property is false, in the original order.

Examples

Example 1

Input
Maps (read), Stars (unread), Rivers (unread)
Expected output
["Stars", "Rivers"]

Example 2

Input
Maps (read)
Expected output
[]

Hints and solution

Hint 1

Filter the records before extracting their titles.

Reveal worked answer

Filter with book => !book.read, then map with book => book.title. Filtering and mapping preserve the order of retained records.

Back to the lesson