Skip to content

Foundations-Object Basics: Add reading on deep & shallow copies #29554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tman2747
Copy link

Because

It would be helpful to introduce the concepts of shallow copy and deep copy before the fourth assignment in this chapter, particularly the palindrome assignment. Some learners may attempt to clean an array and then assign it to a new variable before calling .reverse() on it. Not realizing that .reverse() mutates the original array.

This PR

  • Adds a reading assignment for two MDN chapters:
    • One on shallow copying of objects and arrays
    • One on deep copying techniques
  • Aims to reduce confusion and improve learning flow during the palindrome assignment

Issue

Closes ##28597

Additional Information

  • This could just as well be added to the additional resources section but I thought It was appropriate here.
  • This is my first time doing a PR so if anything needs changed or fixed I'd be happy to do it :)

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: Foundations Involves the Foundations content label Mar 27, 2025
@CouchofTomato CouchofTomato requested review from a team and codyloyd and removed request for a team March 28, 2025 12:54
@rlmoser99
Copy link
Member

While I understand the reasoning for wanting to include this in the lesson, I am of the viewpoint that the concept of shallow and hard copy is one that is good for the learner to stumble upon themselves. It is a great exercise to see behavior that you are not expecting and learn how to find the solution for yourself.

I'd love to know what @codyloyd thinks, before I speak for the team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: Foundations Involves the Foundations content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants