Loading video player…

Welcome to the Translator's Quote Lines

This course shows you how JavaScript writes functions: what a function hands back, how its parameters get defaults, small functions written as arrows, functions passed around as values, and named options where Python has keyword arguments.

Your project is a freelance translator’s Python quote script, and you’ll port it to JavaScript. Here’s a first taste. In Python, her quote() function hands back two results, the fee and the turnaround, for a 6,200-word contract:

Language: Program Output
(744.0, 5)

Ported line for line to JavaScript, with return fee, days;, the function runs without an error and logs one number, the turnaround:

Language: Program Output
5

The fee is gone. This course shows you where it went, and the other spots where a ported function gives a different answer instead of an error.

The translator gets about ten quote requests a day. Her Python script prices each one with the same rules: a per-word rate, a minimum fee, a rush surcharge, and a turnaround in working days. Her new quote form runs on JavaScript, so you’ll port her functions.

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

  • Return early from a function, and return two results
  • Give parameters defaults
  • Know what an arrow function returns, and pass functions around
  • Take named options where Python uses keyword arguments
  • Port the whole quote script to JavaScript

You only need to know how to write Python functions with def, default arguments, keyword arguments, and return. In JavaScript, you only need to know how to write a small program with const, if, basic functions and arrows, objects, the conditional operator, and array destructuring.

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. A project puts the quote script together, and a quiz and a summary close the course.

Next up: Returning Early From a Function, a text lesson.

Download

Sample Code (.zip)

11.7 KB
Download

Course Slides (.pdf)

818.5 KB

00:00 Welcome to JavaScript Functions for Pythonistas! This course shows you how JavaScript writes functions. Your project is a freelance translator’s Python quote script, which works out each contract’s fee by the word and its turnaround in days.

00:15 You’ll port it to JavaScript. Here’s a first taste.

00:21 This Python function works out both the fee and the turnaround for a 6,200-word contract. Here’s the JavaScript port, line for line. It runs with no error and logs one number: five.

00:37 That’s the turnaround. Same return line, same two names. Where did the fee go? This course shows you where it went, and the other spots where a ported function gives a different answer instead of an error.

00:53 The translator gets about ten quote requests a day, and her Python script prices each one with four rules: a per-word rate, a minimum fee, a rush surcharge, and a turnaround.

01:06 Her new quote form runs on JavaScript, so you’ll port her functions.

01:12 By the end, you’ll return early and return two results, give parameters defaults, know what an arrow returns, pass functions around, and take named options.

01:23 Then the project ports the whole script.

01:28 You only need to know Python functions with defaults and keyword arguments, and basic JavaScript: functions, arrows, objects, and array destructuring.

01:39 Short videos mix with text lessons and exercises, and every video has a summary below it. A project, a quiz and a summary close the course. Next up is Returning Early From a Function, a text lesson.

Become a Member to join the conversation.