TGViewer
JavaScript test JavaScript test @js_test · 9.68K subscribers
Post #4792 879
❗️Что будет на выходе:
async function demo() {
console.log('1');

setTimeout(() => console.log('2'), 0);

Promise.resolve().then(() => {
console.log('3');
setTimeout(() => console.log('4'), 0);
});

await Promise.resolve();
console.log('5');

queueMicrotask(() => console.log('6'));
}

demo();
console.log('7');

Ответ: 1, 7, 3, 5, 6, 2, 4

JavaScript test | #JavaScript
More from @js_test
  1. Oct 17, 2026❗️Что будет на выходе: function greet(name) { return `Hello, ${name}!`; } function highlig…
  2. Oct 17, 2026❗️Что будет на выходе: const counter = (function () { let count = 0; const history = []; r…
  3. Oct 16, 2026❗️Что будет на выходе: const memoryLeak = () => { const cache = new Map(); const weakCache…
  4. Oct 16, 2026❗️Что будет на выходе: const createMathOps = (base) => { return { add: (x) => base + x, mu…
  5. Oct 16, 2026❗️Что будет на выходе: const person = { name: 'Alice', greet() { return `Hello, I'm ${this…
  6. Oct 15, 2026❗️Что будет на выходе: try { try { // Creating a custom error type class CustomError exten…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →