StaffCoder
Typescript

TypeScript Practice Exercises

Node.js 24
3 modules · 13 challengesSign up
Modules3 modules · 13 challenges
Module 1 of 3 · 4 challenges

Values, Control Flow & Arrays

Learn how TypeScript handles numbers, text and decisions by building an online store's checkout maths. Keep money in whole cents so totals add up exactly, spot NaN, compare with ===, branch with if and switch, loop over a cart's lines and total them per category, and let TypeScript check every value's type.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Line Item Prices

Sign up to unlock
—No data yeteasy
About this challenge

Convert store prices to integer cents, total a cart line safely and render a price label.

Solved in a browser IDE and graded by tests. Sign up to solve

Discount and Shipping Rules

Sign up to unlock
—No data yeteasy
About this challenge

Turn promo codes into discounts, round discounts to whole cents and pick the shipping fee for a subtotal.

Solved in a browser IDE and graded by tests. Sign up to solve

Cart Category Totals

Sign up to unlock
—No data yeteasy
About this challenge

Loop over a cart's lines to total the order, count its items and break the spend down by category.

Solved in a browser IDE and graded by tests. Sign up to solve

Order Summary

STAR
Solving it completes the module
—No data yeteasy
About this challenge

Combine the given price, discount, shipping and cart functions into one checkout summary that leaves broken lines out.

Solved in a browser IDE and graded by tests. Sign up to solve

Frequently asked questions

4

What will I practice in this path?

3 modules: Values, Control Flow & Arrays, Functions & Text and Custom Types.

How many TypeScript exercises are there, and how hard are they?

13 exercises, all easy.

What does this path run on?

Challenges run on Node.js 24.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.