Write a function named searchMessages that receives 2 parameters:
messages, each with 2 properties:body - the text inside the messagesentAt - a Date representing when the message was sentsearchTermThe function should find all messages that match the searchTerm. A message matches it if:
bodybodyThen return all those messages in descending order based on:
searchTerm they matchsentAt property (newest first)NOTE: the search is not case sensitive
messages
=searchTerm
=Unlock all functions
The first 10 functions are free. Get lifetime access to all 100 with a one-time payment — no subscription.
Upgrade to Pro