This course shows you how JavaScript programs import modules, take command-line arguments, and work with files. Imports, arguments and files all have JavaScript counterparts, but a few of the differences fail quietly.
Your project is a school site manager’s Python tool for the weekly boiler log, and you’ll port it to JavaScript. Here’s a first taste. The Python script takes the log’s name and the limit from the command line, and prints both. These are its first lines:
import sys
def main():
path = sys.argv[1]
threshold = float(sys.argv[2])
print(f"Checking {path} against {threshold}")
if __name__ == "__main__":
main()
Run as python digest.py logs/week-44.log 75, it prints this:
Checking logs/week-44.log against 75.0
Here’s the line-by-line JavaScript port of those lines, digest.js:
const path = process.argv[1];
const threshold = Number(process.argv[2]);
console.log(`Checking ${path} against ${threshold}`);
Run the same way with node digest.js logs/week-44.log 75, it logs this, with no error:
Checking /home/dev/boiler-digest/digest.js against NaN
Instead of the log’s name, you get the script’s own path, and the limit is NaN: not a number.
The path depends on where the script is on your system, and on Windows it starts with C:\.
You’ll see where both come from.
That site manager is Dev. Every Friday, the heating contractor wants the boiler’s peak flow temperature and every reading over 75 °C. The school’s new dashboard runs on JavaScript, so you’ll port his tool.
By the end of this course, you’ll be able to:
- Import from your own modules, and choose what each one shares
- Run a module as a script that reads command-line arguments
- Read and write files
- Port the whole boiler log digest to JavaScript
You only need to know how to write Python scripts that import your own modules, read sys.argv,
and open files. In JavaScript, you only need to know how to write a small program with functions,
arrays, objects, for...of loops, 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 digest together, and a quiz and a summary close the course.
Next up: Importing From Your Own Files, a video.