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 Shipping Label Maker

In JavaScript, the plain object does the everyday work of Python’s dict, all the way to JSON, and a Set does the work of a set. Your project is to port the label script for Marta’s notebook shop.

Here’s a first taste, with order 1042’s insured value. Iris chose no cover, so the value is 0. This Python code reads it with .get() and a default of 50, which is only for orders without the key:

Language: Python
order = {"id": 1042, "insured_value": 0}
insured = order.get("insured_value", 50)
print(f"Insured value: £{insured}")

Python keeps the 0:

Language: Program Output
Insured value: £0

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.