"are calls to javascript methods thread-safe or synchronized?" Code Answer

3

other than html5 web workers (which are very tightly controlled and not apparently what you are asking about), javascript in the browser is single threaded so regular javascript programming does not have thread safety issues. one thread of execution will finish before the next one is started. no two pieces of javascript are running at exactly the same time.

things like ajax responses go through an event queue and are only executed when any other thread of execution has finished.

see do i need to be concerned with race conditions with asynchronous javascript? for more info.

for a specific discussion of ajax response callbacks see how does javascript handle ajax responses in the background?.

By user123417 on August 7 2022

Answers related to “are calls to javascript methods thread-safe or synchronized?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.