A teammate asks: “How many messages about returns came in, and which ones are they?” In this course, you’ll write the JavaScript that answers with a number you can check.
What You’ll Be Able to Do
- Write logic that selects the right messages and counts them, keeping the messages behind the answer.
- Start with one message and one yes-or-no question about it.
- Visit every message in a list and count the matches.
What You’ll Build
Your code will answer the teammate with a report like this one, built from four invented customer messages:
2 messages with an approved
"returns"label: 21 and 24. Message 22 has a pending"returns"label that hasn’t been reviewed yet.
In the project, you’ll build that report in two supplied functions. One hands back the matching messages themselves, and the other counts them. Both work for any topic, even when no message matches. Then you’ll explain why one message is in your report and another is out, and say which labels you counted.
AI can write useful code. Knowing how code works lets you describe what you want, check the result, and adapt it.
What You Need
You need to read a field from a record and fill in a function an exercise supplies.
Up first is Ask One Message a Yes-or-No Question.
You can keep a local reference copy of this course’s source code. Try the exercises before opening the completed solutions: