Javascript — Asynchronous JavaScript
JavaScript runs in a single thread but handles asynchronous tasks like data fetching or timers using callbacks, promises, and async/await. These patterns prevent blocking the program while waiting for operations to complete, ensuring smooth user experiences.
fetch('https://api.example.com/data')
.then(response => response.json())
.then(data => console.log(data));
async function getData() {
const response = await fetch('https://api.example.com/data');
const data = await response.json();
console.log(data);
}