Skip to content

Commit b7f3351

Browse files
committed
add null undefined
1 parent b419027 commit b7f3351

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

09-types-null-undefined.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
## Null and Undefined
3+
4+
- Used to express 'nothing' in JavaScript.
5+
6+
- If we declare a variable, and don't set anything to it, then it has value `undefined`.
7+
8+
```javascript
9+
let dog;
10+
console.log(dog); // undefined
11+
12+
```
13+
14+
When we try to access a variable that is created but not defined/set a value, we get `undefined`.
15+
16+
- **null:** value of nothing
17+
18+
```javascript
19+
const somethingNull = null;
20+
// we have explicitly set the value to be nothing with null
21+
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy