TLDR: Use for...of
instead of forEach()
in asynchronous code.
For legacy browsers, use for...i
or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
// for multiple requests | |
let isRefreshing = false; | |
let failedQueue = []; | |
const processQueue = (error, token = null) => { | |
failedQueue.forEach(prom => { | |
if (error) { | |
prom.reject(error); | |
} else { | |
prom.resolve(token); |
.sticky { | |
position: absolute; | |
right: 0; | |
z-index: 150; | |
transform: rotate(5deg); | |
width: 200px; | |
min-height: 150px; | |
margin: -10px 10px 10px; | |
padding: 10px; | |
font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Comic Neue", cursive; |
[ | |
{ | |
"id": 1, | |
"name": "Adana", | |
"latitude": "37.0000", | |
"longitude": "35.3213", | |
"population": 2183167, | |
"region": "Akdeniz" | |
}, | |
{ |
sass/ | |
| | |
|– base/ | |
| |– _reset.scss # Reset/normalize | |
| |– _typography.scss # Typography rules | |
| ... # Etc… | |
| | |
|– components/ | |
| |– _buttons.scss # Buttons | |
| |– _carousel.scss # Carousel |