Basics: Types

Variables in JavaScript do not have a “fixed type”.

Once you assign a value of some type to a variable, you can later reassign the variable to host a value of any other type, without any issue.

In JavaScript, we have 2 main kinds of types: primitive types and object types.

Primitive types are:

  • numbers
  • strings
  • booleans
  • symbols

And two special types: null and undefined.

Any value that’s not of a primitive type (a string, a number, a boolean, null, or undefined) is an object.

We’ll talk more about objects later on.

The main difference I mention now about primitive types and objects is that objects are passed by reference, while primitive types are passed by value. This is a concept that will be useful when we’ll introduce functions.

Lessons in this unit:

0: Introduction
1: Literals, identifiers and variables
2: Comments
3: The difference between let, const and var
4: ▶︎ Types
5: Operators and expressions
6: Let's start with arithmetic operators
7: The assignment operator
8: Operators precedence
9: Strings
10: Numbers
11: Semicolons, white space and sensitivity
Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. Launching May 21, 2024. Join the waiting list!