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

+21
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)