JavaScript Tutorial Easy To Learn


What is JavaScript ?

JavaScript is a light weight programming language which is also known for Client Side Scripting language. Javascript code is executed on client side on client browser. No need of server to execute Javascript Code.Javascript is easy to use because it is integrated with html for web development.It is open source and cross platform.
Javascript are not used in the web based environment.It is a programming language with capabilities of Object oriented features.
JavaScript was developed by Brendan Eich while he was working for Netescape Corporation.Javascript was firstally introduce as Livescript but later on Netescape changed its name to Javascript being inspired with Java.

Specification :

Javascript is light weight dynamic programming language.
Easy to integrate with Java
Easy to integrate with HTML
Open source and cross platform technology.

JavaScript Syntax:

A JavaScript language consist of JavaScript code or statement within <script></script> tags of html in a webpage.
You can place your JavaScript code with <script> tag anywhere in webpage but it is mostly preferred to put inside within head tag of html webpage. The <script> tag send request to browser to interpret all code or program as script.
The syntax of JavaScript is shown below .Just take a look.
<script …….>
JavaScript Code…….
The Scripts tag uses mainly two attributes which are as follows:
Language – Language attribute describe within script that which Scripting language you are using.
Type  –      This attribute is used to represents type of scripting language which are in used at a time and its value is required to be set as “text/javascript”.
So , Now your JavaScript syntax will look like this..

<script language=”javascript” type=”text/javascript”>
Your JavaScript code

Your first Javascript program:

How to print hello world in JavaScript.
<script language=”javascript” type=”text/javascript”>

document.write(“Hello World!”)

Output: You will get your output which is

Hello World

Comments in JavaScript:

JavaScript supports single line comment and multiple line comments.
Multiple line: Any text or strings written between the characters /* and */ is treated as a comment.
Single line : <!–. JavaScript treats this as a single-line comment, just as it does the // comment. It is used for single line comment.


JavaScript Placement Within HTML File:

JavaScript is a very flexible language which can be used anywhere in the html file. But there are some preferred ways to include or use your script code within html page.
• Script can be put within <head> …….</head> section.
• Script can be put within <body> ………</body> section.
• Script can be put within <head> ………</head> and <body> ……..</body> section.
• Script when external file then it is included in <head> ……….</head> section.

Leave a Reply

Your email address will not be published. Required fields are marked *