What is the difference between event driven languages like javascript and synchronous languages like ruby?
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.