Locked learning resources

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

Unlock This Lesson

Locked learning resources

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

Unlock This Lesson

Welcome to the End-of-Day Release Note

JavaScript code has a different shape from Python’s. Its blocks, statements, line breaks, and names follow their own rules, and code that looks right by Python’s rules can run differently. Here’s the bug check from a release-note script on a day with no open bugs, first in Python:

Language: Python
BUGS_OPENED = 9
BUGS_CLOSED = 9
open_bugs = BUGS_OPENED - BUGS_CLOSED
print(f"Open bugs: {open_bugs}")

if open_bugs > 0:
    print("Please check the bug tracker.")
    print("Triage call at 9:30 tomorrow.")

Python prints Open bugs: 0 and skips both lines under its if. Here’s a JavaScript port, indented the same way:

Language: JavaScript
const BUGS_OPENED = 9;
const BUGS_CLOSED = 9;
const openBugs = BUGS_OPENED - BUGS_CLOSED;
console.log(`Open bugs: ${openBugs}`);

if (openBugs > 0)
  console.log("Please check the bug tracker.");
  console.log("Triage call at 9:30 tomorrow.");

When you run it with no open bugs, it still prints the second line, and there’s no error:

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

00:01 Welcome to JavaScript Syntax for Pythonistas! You’ve written a little JavaScript already. This course is about its shape: how JavaScript marks blocks, ends statements, and names things, and where that differs from Python.

00:14 Your project is a web agency’s end-of-day release note, the Python script that whoever ships last runs for the client, and you’ll port it to JavaScript. Here’s why it matters.

00:28 On a day with no open bugs, this Python note skips both lines under its if. Here’s the JavaScript port, with the same two lines indented under its if, and no braces.

00:41 It books a triage call for bugs that don’t exist. No error. Why? The indentation looks right. This course is about the shape of JavaScript code, and why code that looks right by Python’s rules can run differently.

01:00 The agency ships to its clients’ sites most afternoons. Whoever ships last edits a few settings at the top of a script, runs it, and pastes the note into the client’s channel.

01:12 Today it’s Fernleaf Bakery, and Maya is deploying. The agency is moving its tools to JavaScript, so you’ll port the script, one kind of line at a time.

01:25 By the end, you’ll read blocks by their braces, end statements and break lines safely, tell expressions from statements, and name things the JavaScript way.

01:34 Then the project ports the whole release note.

01:40 You’ll need Node installed and a little JavaScript: names, if, and functions.

01:47 Short videos like this one mix with text lessons and exercises, and every video has a summary below it. A project puts it together, and a quiz and a summary close the course.

01:59 The next video, Reading Blocks by Their Braces, starts with this same if.

Become a Member to join the conversation.