A First Tour of JavaScript for Pythonistas (Summary)

Congratulations, you made it to the end of the course! The crew’s dock report now runs in JavaScript. Before each shift, dock-report.js goes through the five docks, skips Market Hall while it’s closed for repairs, flags Elm Street as empty and Harbor Square and Riverside Park as nearly full, and tells the van to start with 6 bikes. It’s the first whole program you’ve written in JavaScript.

In this course, you learned how to:

  • Declare each name with const by default, and with let only for a name you’ll reassign, such as docksChecked
  • Build strings with template literals, putting any expression in a ${...} hole
  • Make decisions with if, else if, and else, comparing with === and combining with &&, ||, and !
  • Loop over an array’s items with for...of
  • Write functions as declarations with an explicit return, and small ones as arrows
  • Use arrays as lists and objects as dicts and records, including an array of objects for the docks

Keep the Habits That Carry Over

Most of what you do in Python still works here. You read the dock list, decide what each dock needs, keep a running total, and print a line per dock, in the same order and with the same logic. A template literal does an f-string’s job, and a function still takes values and hands one back. for...of walks a list the way Python’s for does, while for...in, the spelling that looks closer to Python, walks the indices.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.