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 Nightly Backup Check

This course is about how JavaScript declares names and what kinds of values it has: const and let, typeof, null and undefined, empty values, and mixing text with numbers. Values that are missing, empty, or text are where JavaScript quietly carries on, or gives a different answer from Python’s. Along the way, you’ll port Kestrel Print’s Python backup check.

Here’s one of those places, on a new server where nobody set BACKUP_BUCKET. These are the check’s key lines in Python. On that server, the check refuses to start:

Language: Python
import os
import sys

bucket = os.environ.get("BACKUP_BUCKET")
region = os.environ.get("BACKUP_REGION")
mode = "live"
retries = 3

if bucket is None:
    print("No BACKUP_BUCKET set: refusing to start.")
    sys.exit(1)

print(f"Backing up to {bucket} in {region} ({mode})")
print(f"Up to {retries + 1} attempts")
print(f"Debug: bucket is {type(bucket).__name__}")

It prints its refusal and exits with status 1:

Language: Program Output
No BACKUP_BUCKET set: refusing to start.

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.