Module 12-The Importance of JavaScript
function
A block of code that performs a particular task.
end user-side language
A programming language only interpreted by the end user machine.
server-side languages
A programming language that is translated into machine code before the code is executed.
event-driven language A programming language that primarily responds to the actions of the end user.
A programming language that primarily responds to the actions of the end user.
What is an advantage of using JavaScript over other programming languages in web development?
As a scripting language rather than a full programming language, JS is more limited in scope which makes it easier to isolate and fix errors.
Interactive Web Pages
HTML CSS JS
What is the main purpose of a scripting language in web pages, according to the W3C?
JavaScript (JS) is intended to provide processing power to web pages.
Advantages of JavaScript
Less server interaction − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server. Immediate feedback to the visitors − They don't have to wait for a page reload to see if they have forgotten to enter something. Increased interactivity − You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard. Richer interfaces − You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.
execution
Performance of an instruction to do something.
JavaScript facts
The JavaScript interpreter runs within the end user's web browser. In other words, the JS program (or script) runs on the end user's device (the client machine, a.k.a. user agent). Therefore, JS is said to be an end user-side language, in contrast to other programs providing the web page (the server machine, a.k.a. server agent) that are programmed in what are called server-side languages, for example Python, Java, and Perl, to cite a few. A great advantage to running JS on the client machine is to increase the speed, as the program does not have to go back and forth from the client machine to the server machine, avoiding any communication delays between the two.
Client-Side JavaScript
The most common form of the language. The script should be included in or referenced by an HTML document for the code to be interpreted by the browser.
Limitations of JavaScript
We cannot treat JavaScript as a full-fledged programming language. It lacks the following important features − Client-side JavaScript does not allow the reading or writing of files. This has been kept for security reason. JavaScript cannot be used for networking applications because there is no such support available. JavaScript doesn't have any multi-threading or multiprocessor capabilities. Once again, JavaScript is a lightweight, interpreted programming language that allows you to build interactivity into otherwise static HTML pages. Unlike HTML and CSS, JavaScript (JS) needs rigor in its specification, meaning that it cannot tolerate imprecision. JS is strict with the expected syntax and notation.
JavaScript (JS)
a scripting language created to provide processing power to hypertext. Interpreted, and not compiled. Contains instructions to respond to user inputs. JavaScript was first known as LiveScript, but Netscape changed its name to JavaScript, possibly because of the excitement being generated by Java. By being an event-driven language, JS is not intended to provide a single entry point, which is a main function of the Java programming language.
HTML
defines the content and structure of web pages.
CSS
provides style definitions for webpage content.