Loading video player…

Welcome to the Branch-Name Helper

This course is about working with text the JavaScript way. Most of Python’s string toolkit is there, often under another name. Where the two differ, the code often runs without an error and prints the wrong text. Along the way, you’ll port a payments team’s Python helper that turns a ticket header into a branch name and a commit subject.

Here’s a first taste. The helper’s first line splits the ticket header with split(":", 1). Here it is in Python, on the header of ticket PAY-2291:

Language: Python
header = (
    "PAY-2291: Refund emails show the wrong currency: "
    "EUR shown as USD"
)

print(header.split(":", 1))

Python gives the ticket’s key, PAY-2291, and the whole title:

Language: Program Output
['PAY-2291', ' Refund emails show the wrong currency: EUR shown as USD']

Here’s the same line in JavaScript, ported as written, with the same 1:

Language: JavaScript
const header =
  "PAY-2291: Refund emails show the wrong currency: " +
  "EUR shown as USD";

console.log(header.split(":", 1));

JavaScript gives the key alone:

Language: Program Output
[ 'PAY-2291' ]

The title is missing, and there’s no error. That’s the kind of difference this course is about.

The payments team names every branch and commit after its ticket, and a review bot rejects anything off the convention: a branch named fix/ followed by the key and the first six words of the title, a commit subject of at most 50 characters with no full stop at the end, and a second reviewer for any ticket that mentions currency.

One developer’s Python helper prints the branch, the commit subject, the ticket number, and whether a second reviewer is needed. The team’s git hooks are moving to JavaScript, so you’ll port the helper.

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

  • Build text with quotes and backticks
  • Read single characters and slices of text
  • Clean text with string methods, and write the few JavaScript doesn’t have
  • Split text apart and join words back together
  • Port the whole branch-name helper to JavaScript

You need to know Python’s string toolkit, from f-strings and slicing with [a:b] to split(), join(), strip(), replace() and in. In JavaScript, you need to know how to write small programs with const, let, if, for...of and template literals, and know its types and ===. Any current version of Node.js is fine: the examples use Node 26 and Python 3.15.

The course mixes videos with text lessons and exercises, and every video has a summary below it. A quiz and a summary close the course.

Next is a text lesson, Building Strings With Quotes and Backticks, which ports the helper’s branch line.

Download

Sample Code (.zip)

8.6 KB
Download

Course Slides (.pdf)

645.5 KB

Become a Member to join the conversation.