Skip to content

Instantly share code, notes, and snippets.

@Goloburda
Goloburda / index.js
Last active May 24, 2020 19:18
for await ()
function makeRequest(arg) {
return new Promise(res => {
setTimeout(() => res(arg), 2000);
});
}
const person = {
name() {
return makeRequest("Mikita");
},
age() {
@Goloburda
Goloburda / index.js
Last active July 11, 2021 15:45
Micro/Macro tasks
// https://www.youtube.com/watch?v=cCOL7MC4Pl0
const button = document.getElementsByTagName('button')[0]
button.addEventListener('click', () => {
setTimeout(() => console.log('Timeout 1'))
Promise.resolve().then(() => console.log('Microtask - 1'))
console.log('task 1')
})