Programming For The Web
Programming For The Web
•JavaScript (unlike HTML) is a programming language which will run on the client- side
• What is the difference between running on the client side and running on the server - side?
» Client – side - the script runs on the computer, which is making the request, processing the
web page data that is being sent to the computer from the server.
» Server – side - the script is run on the web server and the results of processing are then
sent to the computer that made the request.
So what can it really do?
•The core client-side JavaScript language consists of some common
programming features that allow you to do things like:
- Store useful values inside variables.
- Operations on pieces of text (known as " in programming).
- Running code in response to certain events occurring on a web page.
- And much more!
Interpreted versus compiled code
• You might hear the terms interpreted and compiled in the context of programming
•In interpreted languages, the code is run from top to bottom and the result of running the code is
immediately returned. You don't have to transform the code into a different form before the browser runs it.
The code is received in its programmer friendly text form and processed
directly from that.
• Compiled languages on the other hand are transformed ( compiled) into another form before they are run
by the computer For example, C/C++ are compiled into machine code that is then run by the computer
Interpreted versus compiled code
• JavaScript is a lightweight interpreted programming language The web browser receives
the JavaScript code in its original text form and runs the script from that.
• From a technical standpoint, most modern JavaScript interpreters actually use a
technique called just-in-time compiling to improve performance; the JavaScript source
code gets compiled into a faster, binary format while the script is being used, so that it can
be run as quickly as possible. However, JavaScript is still considered an interpreted
language, since the compilation is handled at run time, rather than ahead of time.