# Data Types — JavaScript Fundamentals: From Syntax to Async

Source: https://www.skillbyai.com/en/javascript/js-data-types

> Work with JavaScript's seven primitive types and objects, and check types with typeof.

## Primitive types

`number`, `string`, `boolean`, `undefined`, `null`, `symbol`, and `bigint` — seven primitives. Everything else is an `object`.

## typeof operator

`typeof` reports a value's type at runtime — handy for quick checks.

```js
console.log(typeof 42);          // "number"
console.log(typeof "hi");        // "string"
console.log(typeof true);        // "boolean"
console.log(typeof undefined);   // "undefined"
console.log(typeof {});          // "object"
console.log(typeof null);        // "object" (a famous quirk)
```

## null vs undefined

`undefined` means a variable was declared but never assigned. `null` is an intentional "no value" you assign yourself.

**Quiz:** What does `typeof null` return?

- [ ] "null"
- [ ] "undefined"
- [x] "object"
- [ ] "function"

*Answer:* "object". It's a long-standing JS bug kept for backward compatibility.
