Loading video player…

Welcome to the Bike-Share Dock Report

This course is a first look at the JavaScript you need to write small programs straight away: names, strings, decisions, loops, functions, arrays, and objects. It’s a quick tour, and more detailed courses on each topic come after it. JavaScript does these everyday things its own way, and the course shows you where that won’t match your Python instincts.

Here’s one of those places. A bike-share’s dock report, in Python, works out how many bikes the van should load, skipping the docks closed for repairs with if dock["name"] in closed:. It prints this:

Language: Program Output
Van load: 6

Ported line for line to JavaScript, with if (dock.name in closedDocks) {, the script runs without an error and prints this:

Language: Program Output
Van load: 11

This course shows you why, and what a JavaScript developer writes instead.

You’ll help a city bike-share’s rebalancing crew, who drive a van between docking stations, moving bikes from full docks to empty ones. Before each shift, a short Python script reads the dock list and prints which docks are empty, which are nearly full, and how many bikes the van should start with. The crew lead wants it in JavaScript, next to the operator’s other JavaScript tools, and you’ll port it one piece at a time.

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

  • Name values with const and let, and build strings with template literals where Python uses f-strings
  • Make decisions with if and else, and loop over an array with for...of
  • Write functions with function, and small ones as arrows
  • Use arrays as lists and objects as dicts
  • Spot the few places where a line-for-line port from Python goes wrong
  • Port a small Python script to JavaScript and run it

You only need to know how to write small Python programs with variables, f-strings, if, for loops, functions, lists, and dicts. In JavaScript, you only need to know how to run a .js file with node and print with console.log().

You’ll also need Node installed. The Getting Started course sets it up, or you can get it from nodejs.org. A current version of Node.js and of Python is fine: the examples use Node 26 and Python 3.15.

The course mixes short videos and text lessons, with exercises where you write the code yourself. Every video has a summary below it, so you can review without rewatching. A project puts the dock report together, and a quiz and a summary close the course.

Next up: Naming Values With const and let, where you declare the report’s first values.

Download

Sample Code (.zip)

7.7 KB
Download

Course Slides (.pdf)

813.7 KB

00:00 Welcome to A First Tour of JavaScript for Pythonistas! You already know Python, and this course is your first real look at writing small programs in JavaScript.

00:10 Your project is a city bike-share’s dock report, the Python script a van crew runs before each shift, and you’ll port it to JavaScript. Here’s a first taste.

00:22 This Python script works out the van’s load: six bikes. Here’s the JavaScript port, line for line. It runs with no error, and the van gets eleven. Same docks, same rules.

00:37 Why eleven? This course shows you how JavaScript does everyday things. It won’t always match your Python instincts, and you’ll see where they bite.

00:50 The crew drives its van between docks, moving bikes from full ones to empty ones. Before each shift, a Python script prints which docks are empty, which are nearly full, and how many bikes the van needs.

01:05 The crew wants it in JavaScript, so you’ll port it, one piece at a time.

01:11 By the end, you’ll name values and build strings, make decisions and loop, write functions, and use arrays and objects. Then the project ports the whole dock report.

01:23 Each topic gets a course of its own later.

01:28 You only need to know how to write small Python programs and run a JavaScript file with the node command. You’ll need Node installed, which the Getting Started course sets up, or you can grab it from the Node website.

01:43 Short videos mix with text lessons and exercises, and every video has a summary below it. A project, then a quiz and a summary, close the course. Next up is Naming Values With const and let, a text lesson.

Become a Member to join the conversation.