Tutor WorkstationTest site

Lesson 1: JavaScript vs TypeScript

The everyday picture

Think of a recipe. JavaScript is a recipe that says "add some sugar". TypeScript is the same recipe that says "add 2 spoons of sugar", plus a checker who reads the whole recipe before you start cooking and says "line 14 asks for 2 spoons of salt where sugar should be. Are you sure?"

What it really is

A tiny example:

let price: number = 100;   // "price is a number"
price = "one hundred";     // the checker stops you: text is not a number

In plain JavaScript that second line is allowed, and the mistake shows up later as a wrong bill.

What it means for your idea

Small mistakes like this are exactly the kind AI makes when it writes code quickly. With TypeScript, the checker catches many of them for you, even if you can't read every line yourself. That makes TypeScript one of the best safety nets a non-coder building with AI can have.

Pick this when...

Quick check

Your app shows a total of "100200" instead of 300. What would TypeScript most likely have done? It would most likely have warned that text was being added to a number, before the app was ever used.

Goes deeper in Modules 17–30.

← All lessonsLesson 2: Java vs JavaScript →