How the JavaScript engine works