https://github.com/secretshardul/javascript-udemy
https://github.com/secretshardul/javascript-udemy
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/secretshardul/javascript-udemy
- Owner: secretshardul
- Created: 2020-02-09T12:28:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-27T10:20:57.000Z (over 5 years ago)
- Last Synced: 2025-01-19T07:24:45.002Z (over 1 year ago)
- Language: JavaScript
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Strict mode
```
'use strict'
```
1. Can't use undeclared variables
```js
x = 5 // Runs otherwise
```
2. Can't use `eval()`: It's a function to run arbitary JS. `eval` is a security issue.
```js
eval('const x = 5')
console.log(x)
```
3. `this` returns undefined in strict mode. It returns the global window object otherwise.
4. Can't delete variables and functions
```js
const x = 5
delete 5
```
# Looping
1. `for...in`: Works for arrays and objects. Loops over keys. Can use async await.
2. `for...of`: For arrays only.
3. `forEach(key, val)`: Arrays only. Can't use async await directly.