Your meal planner now does everything the Okafor family asked for. It builds next week from last week, swaps two dinners, removes the takeout pizza, adds egusi soup, and prints both weeks. diffPlans() names the days that really changed. The tests have checked what your functions return, but they can’t tell whether you can explain why last week stayed as it was.
In this review, you’ll explain your planner to your mentor, out loud in your own words, and then make an unfamiliar change to the plan. You’ll predict which names reach the same object, and you’ll write an update that leaves the original alone.
Get Your Planner Ready
The conversation works from your code, so have it in front of you before you begin. The two project exercises ran in the browser, so first put their pieces together in one file of your own:
- Create
planner.jsand paste in thelastWeekarray from the final code of Trace Two Names to One Object. - Below it, paste your four functions from Exercise: Plan Next Week, then
diffPlans()and its helper from Exercise: Compare Two Plans. Delete theexportin front of each function. - At the end, add the five closing lines from the project brief, then
console.log("Changed:", diffPlans(lastWeek, nextWeek));. - Run
node planner.jsand check that it prints both weeks as in the brief’s printout, followed by the changed days.