Introduction JavaScript
You need to create dynamic Web page, which offers interaction with the user. For example, you may require creating a Web page that not only accepts values from the user but also validates the values, and PHP, is a program code embedded into HTML code to enhance the functionality of the Web page. Among these, JavaScript is the most popular scripting language used for infusing dynamism and interactivity in Web pages.
JavaScript (originally named LiveScript by its creator Netscape and Sun Microsystems) is a client-slide, object-based scripting language that offers various functionalities such as validating forms. The scripts written in JavaScript are processed and run one line at a time, which is why JavaScript is an interpreted language. The scripts are interpreted by the JavaScript interpreter that is an inbuilt component of the Web browser. Client-slide scripting refers to the programs on the Web that are executed at the client-side instead of the server-side by the user’s Web browser. While working with the JavaScript scripts, the in-built objects and other programmable features, such as control flow statements and events, can be used to make the HTML. Web pages dyanamic. Therefore, JavaScirpt is a scripting language that is embedded directly into an HTML page. It helps in adding interactivity to an HTML page.
In this tutorial, you learn about adding a script in an HTML document and working with JavaScript objects. You also learn how to write the JavaScript scripts by using statements, variables, operators, control flow statements, functions, arrays, events, popup boxes, and exceptions. Moreover, you also learn the new concept-Geolocation API, which is a new feature of HTML 5.
Let’s begin with adding a JavaScript script in an HTML document.