-2

I have confused with synchronous and assynchronous in javascript is javascript is a synchronous or assynchronous ,suggest your idea or any relevant website , thanks

cнŝdk
  • 31,391
  • 7
  • 56
  • 78
nirmal
  • 51
  • 5
  • 3
    Have you tried looking for it? http://stackoverflow.com/questions/2035645/when-is-javascript-synchronous – andrusieczko Jan 22 '15 at 08:49
  • It's both synchronous and asynchronous, take a look at [Synchronous and asynchronous requests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests). – cнŝdk Jan 22 '15 at 08:55

1 Answers1

1

You can write either synchronous or asynchronous code in JavaScript. It is not only one or another. For instance, an ajax call is asynchronous by it's nature. On the other hand, when you execute a function to show an alert with a message when a button will be clicked is clearly an not asynchronous job. Hence, as you understand there are areas in JavaScript as in other programming languages, where we make use of asynchronous programming and others in which we make use of synchronous programming.

Christos
  • 53,228
  • 8
  • 76
  • 108