7 / 11 · Book 12 · Your First Program← prev⊞ allnext →Get the book →
1.7Errors Are Your Friend
When you make a mistake, the interpreter tells you what went wrong. Read the message carefully.
print("Hello)
# SyntaxError: unterminated string literal
print(hello)
# NameError: name 'hello' is not defined
console.log("Hello)
// SyntaxError: Invalid or unexpected token
console.log(hello)
// ReferenceError: hello is not defined
// TypeScript catches errors BEFORE you run the code
const msg: string = 42;
// Type 'number' is not assignable to type 'string'.
Pro Tip: TypeScript's compile-time errors are one of its biggest advantages for QA. Bugs caught before execution never reach production.