Javascript Introduction: A guide for beginners

· Dev & Design

What is JavaScript?

JavaScript (also called JScript) is a scripting language with the primary aim of giving life to our web pages.It is very powerful, flexible, and easy to learn.

JavaScript is: An interpreted language.This means that the code is executed straight away by an interpreter, which is built into web browsers, some web servers and Antechinus JavaScript Editor. JavaScript is sometimes used instead of VBScript for customizing applications.

An object-Oriente based language. You can create your new objects in JavaScript (or use the predefined ones), but not by inheriting from existing objects like fully-fledged object-oriented languages (C#, C++ or Java).

Not Java. Although JavaScript resembles languages like Java, C and C++, it is a language of its own.

Loosely typed. Languages like C# or C++ require that you declare the data type of the variables you are using. JavaScript does not. Most functions (for example, alert() ) will happily accept variables of different types and if needed convert them on the fly from one type to another.

Meant for “client-side” scripting. When visitors come to your web pages spiced with JavaScript, the code will executes on their machines. By comparison, PHP code will executes on the web server (“server-side” scripting) to output the HTML code, which is then fed to visitor’s web browsers.

Your First JavaSscript Code Example

   <script type=”text/javascript”>
     document.write(“Vyom Technosoft!”)


Our first steps tell to the browser we were using a script with <script> tag. Next we set the type of scripts equal to “text/javascript”, which you may notice that doing this is similar to the way you specify in CSS, which is “text/css”.

Next we added an optional HTML comment that surrounds our Javascript code. If a browser do not support Java Script, then it will not display our code in plain text to the user! The comment was ended with a “//–>” because “//” signifies a comment in Javascript, so we add that to prevent a browser from reading the end of the HTML comment in as a piece of Javascript code.

Javascript document.write

The final step of our script was to use a function that was called document.write which writes a string into our HTML document. document.write can be used to write text, HTML, or a little of both. We passed the famous string of text to the function to spell out “Vyom Technosoft!” which was printed to the screen.

Do not worry if you do not completely understand how document.write works, as we will be discussing functions in a later section of the our Academic Tutorial.


Looking at our Java Script above code given, mark that there is no semicolon (;) at the end of the statement “document.write(Vyom Technosoft!)”. Why? Because Javascript does not require that you use semicolons(;) to signify the end of each statement.

If you are well experienced programmer and prefer to use semicolons, feel free to do so. Javascript will not malfunction from ending semicolons. The only time where it is necessary to use a semicolon is when you choose to smash or add two statements onto one line(i.e. two document.write statements on one line).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s