Skip to content

Comments

Raghad Alobaid & Humoud alghanem#12

Open
rfo97 wants to merge 1 commit intoJoinCODED:mainfrom
rfo97:main
Open

Raghad Alobaid & Humoud alghanem#12
rfo97 wants to merge 1 commit intoJoinCODED:mainfrom
rfo97:main

Conversation

@rfo97
Copy link

@rfo97 rfo97 commented Mar 12, 2025

No description provided.

return {
...student,
courses: student.courses.filter((c) => c !== course),
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is clever, but it would be preferable to do this:

student.courses = student.courses.filter((c) => c !== course);
return student;

This way we don't break the reference to the original object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants