DEV Community

Praveen
Praveen

Posted on

Call back function we

What is Synchronous JavaScript?
In synchronous programming, operations are performed one after the other, in sequence. So, basically each line of code waits for the previous one to finish before proceeding to the next. This means that the program executes in a predictable, linear order, with each task being completed before the next one starts.

What is Asynchronous JavaScript?
Asynchronous programming, on the other hand, allows multiple tasks to run independently of each other. In asynchronous code, a task can be initiated, and while waiting for it to complete, other tasks can proceed. This non-blocking nature helps improve performance and responsiveness, especially in web applications.

call back function.
Call back function is an passed an argument into Anto another function

Java script is single threaded programming language
JavaScript is traditionally single-threaded because it operates in a single execution context — there is one call stack where functions are pushed and popped as they are executed. In JavaScript, the call stack operates on a LIFO (Last In, First Out) basis, where functions are executed in the order they are pushed onto the stack.

However, just because JavaScript is single-threaded doesn’t mean it’s inefficient or incapable of handling multiple tasks. The secret lies in JavaScript’s ability to handle asynchronous operations using non-blocking features.

Top comments (0)