Programming Foundations π§±
Intro
Intro to Introduction to Programming Foundations
π¨βπΌ Hello! I'm Peter the Product Manager, and I'm excited to guide you through
the foundations of TypeScript programming.
In this workshop, we'll explore how values move through programs. This is
the fundamental skill you need to write code that works reliably.
We'll cover:
- Expressions and Output - Using
console.log()to see results, working with strings and numbers - Variables and Immutability - Using
letvsconstand understanding when values can change - Primitive Types - Understanding type annotations for
number,string,boolean, and the difference betweennullandundefined - Control Flow - Making decisions with
if/elseand repeating work with loops - Functions - Creating reusable pieces of code with typed parameters and returns
- Void and Never - Understanding functions that don't return values or never return at all
This workshop establishes the confidence you need to write code that compiles
(actually runs). Every concept here forms the foundation for everything else
you'll learn in TypeScript.
By the end of this workshop, you'll be able to:
- Use
console.log()to understand what your code is doing - Declare variables with appropriate types
- Write functions with type-safe parameters and returns
- Use control flow to make decisions and iterate over data
- Understand how TypeScript helps catch errors before your code runs
Let's build something solid! ποΈ
Semicolons and ASI: JavaScript has Automatic Semicolon Insertion (ASI),
which means the runtime can insert semicolons when you omit them. In this
workshop, we leave semicolons out because our tooling handles the edge cases
(e.g. formatting and linting), and it's a style preference. It's also easier
to remember the few rules for when you must add a semicolon than to
remember all the rules for when you can safely omit them while still using
semicolons. If you're curious about the details and tradeoffs, see Semicolons
in JavaScript: A
preference.
Code comments are notes you write in your code that explain what it does.
Code comments start with
// for single-line comments or /* */ for multi-line
comments. Comments are ignored by TypeScriptβthey're just for humans to read.
You'll see comments throughout the exercises to help explain concepts. Feel
free to add your own comments to help you understand the code! Here are some examples:// This is a single-line comment
/*
This is a
multi-line comment
*/
/*
* Sometimes you'll see multi-line comments
* with a star at the beginning and end.
* These extra stars are unnecessary, but
* look nice so people use them.
*/
π΅ Check out the workshop theme song! πΆ
Loading "Programming Foundations Theme Song"