Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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)

AltStyle によって変換されたページ (->オリジナル) /