JavaScript Introduction

– JavaScript is an interpreted, object-based scripting language.

– JavaScript is the client side script(The script that is executed client-side, by the user’s web browser)

– JavaScript is a prototype-based scripting language(Prototype-based programming is a form of OOPS in which inheritance is performed through a process of cloning existing objects that serve as prototypes.) with dynamic typing.

– JavaScript is organized into statements, blocks consisting of related sets of statements.

– JavaScript also allows the comments like other programming languages.

Example

<!DOCTYPE html>
<html>
<head>
<script>
function CallFunction()
{
alert("Hello World!");
}
</script>
</head>
  <body>
    <button onclick="CallFunction()">Click  Here</button>
  </body>
 </html>

You can see the JavaScript code in the script code. When the user will click on the button ‘Click here’ the JavaScript code will be executed.

<script>
function CallFunction()
{
alert("Hello World!");
}
</script>

You can run the program by copy all code and paste in the text file and save with chapter1.html. After the save the file just open in any browser and click on the button.

In the next Chapter, we will start with the declaring variables and use the statements.