Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Understanding Asynchronous JavaScript | Section
JavaScript Essentials for Backend

bookUnderstanding Asynchronous JavaScript

Свайпніть щоб показати меню

JavaScript does not always execute code step by step from top to bottom.

Some operations take time, such as reading data, making requests, or waiting for a response. JavaScript handles these operations asynchronously, which means it does not block the rest of the code while waiting.

console.log("Start");

setTimeout(() => {
  console.log("Done");
}, 1000);

console.log("End");

Even though the timeout is written in the middle, the output will be:

Start
End
Done

This happens because the delayed operation runs later, while the rest of the code continues immediately.

This behavior is important in backend development because many tasks involve waiting, such as database queries or API calls.

question mark

What will this code output?

Виберіть правильну відповідь

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 13

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Секція 1. Розділ 13
some-alt