All programming languages work by translating English syntax into machine code, which is then executed by the operating system. JavaScript can broadly be categorized as a scripting or interpreted language. JavaScript code is interpreted, that is, directly translated into machine language code by the JavaScript engine. In other programming languages the compiler processes all the code into machine code in a separate step. Thus, all scripting languages are programming languages, but not all programming languages are scripting languages.
JavaScript engine
A JavaScript engine is a computer program that executes JavaScript code. The first JavaScript engines were just interpreters, but all modern engines use JIT compilation or run-time compilation to improve performance.
Client-side JavaScript
Client-side JavaScript refers to the way JavaScript works in your browser. In this case, the JavaScript engine is inside the browser code. All major web browsers have their own built-in JavaScript engines.
Web application developers write JavaScript code with different functions associated with different events, such as clicking or hovering. These functions make changes to HTML and CSS.
Below is an overview of how JavaScript works on the client side.
- The browser loads the web page when you visit it.
- As it loads, the browser converts the page and all of its elements, such as buttons, shortcuts, and dropdown fields, into a data structure called a document object model (DOM).
- The browser’s JavaScript engine converts JavaScript code into bytecode. This code mediates between the JavaScript syntax and the machine.
- Various events, such as a mouse click on a button, cause the associated block of JavaScript code to be executed. The engine then interprets the bytecode and makes changes to the DOM.
- The browser displays the new DOM.
Server-side JavaScript
Server-side JavaScript refers to the use of a coding language in internal server logic. In this case the JavaScript engine resides directly on the server. The server-side JavaScript function can access the database, perform various logical operations, and respond to various events triggered by the server’s operating system. The main advantage of server-side scripting is that you can largely customize the site response according to your requirements, access rights, and site information requests.
Client side and server side
The word dynamic describes both client-side and server-side JavaScript. Dynamic behavior is the ability to update the display of a Web page to generate new content as needed. The difference between client-side and server-side JavaScript is the generation of new content. need.