Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the difference between event driven languages like javascript and synchronous languages like ruby?

0
Posted

What is the difference between event driven languages like javascript and synchronous languages like ruby?

0

I would not characterize JavaScript as an event-driven programming language. JavaScript is an imperative language in which functions themselves are objects and form closures to retain access to the scope in which they were defined. Browsers take advantage of JavaScript’s first-class functions to expose an event-heavy API. Ruby, C, and many, many other languages support event-oriented programming as well. Events amount ultimately to an I/O handling pattern whereby programs repeatedly ask the operating system what input is available and handles it. JavaScript’s input comes ultimately in the form of clicks and keypresses. Your code handles the event and causes the browser to repaint the screen. In Ruby or C the input might be an incoming HTTP request. The evented web server handles it and sends the response back.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.