Copying, Freezing, and Sorting JavaScript Arrays for Pythonistas

Stephen Gruppetta 15 Lessons 2h 32m Updated intermediate js py

A line-for-line port can run without an error and still change data you meant to keep. Port copy.deepcopy(table) as [...table], update the provisional table with the week’s results, and the confirmed table changes too: every team’s move reads same, and the confirmed leaders come out as Rovers when Python says Athletic.

In this course, you’ll port a volunteer league secretary’s Python script, which keeps each week’s results provisional until the committee confirms them, to JavaScript.

By the end of this course, you’ll be able to:

  • Copy arrays, records, Maps, and Sets where Python uses table.copy() and {**rovers}, and make a deep copy with structuredClone()
  • Make tuple-like data read-only with Object.freeze()
  • Sort records with compare functions where Python passes key=, and break ties between teams level on points
  • Change a copy, not the original, with with() and toSpliced()
  • Port the whole league table script to JavaScript

You’ll need Python’s shallow and deep copies, tuples as records that can’t change, and sorting with a key function, plus Node 26 and the JavaScript you’ve already used: arrays of objects, arrow functions, copying an array with slice(), sorting numbers with a compare function, and Map and Set. The Python examples use Python 3.15.

The course mixes short videos and text lessons with exercises, a project that ports the whole league table script, and a quiz.

What’s Included:

  • 15 Lessons
  • Video Subtitles and Full Transcripts
  • Translated Subtitles in 8 Languages
  • 2 Downloadable Resources
  • Interactive Quiz to Check Your Progress
  • 5 Hands-On Coding Exercises
  • Q&A With JavaScript Experts: Ask a Question
  • Certificate of Completion

Downloadable Resources:

Related Learning Paths:

Getting Started

1 Lesson 1m

  1. 1. Welcome to the League Table01:57

About Stephen Gruppetta

Stephen obtained a PhD in physics and worked as a physicist in academia for over a decade before becoming a programming educator. He's constantly looking for simple ways to explain complex things.

» More about Stephen

← Browse All Courses