What is Javascript?

What is javascript and a small java exampleJavaScript is probably the most widely used scripting language on the Internet. Anyone can use javascript as it requres neither downloaded or to be purchased. JavaScript is a language that you type directly into your HTML pages and most browsers will then know how to handle your javascript.

JavaScript is a programming language that you can use to make your websites interactive / dynamic ( your pages can be changed depending on user input or by the code). Example, you can create popup windows, login forms, a personal greeting to your visitors ,a calculator,a traffic counter, warning popups and much more.

It’s the browser that provides the “compiling” of your JavaScript , then all you need is to write it in your HTML code and it will be displayed and read if coded correctly.

If you are a beginner when it comes to JavaScript, you do not be alarmed that this refers to the programming. There are plenty of ready-made JavaScripts available online that you can easily copy and customize to your own needs. Javascript is a pretty simple language to learn. It has a nice and clean syntax and can do many things that other scripting languages such as Perl or PHP can’t do like for instance make dynamic changes to an existing website. For instance PHP can create the website and show it to the user, but it can’t change the color resize the page without having to reload it. This can easily be done with Javascript which is one of the reasons that it’s such as popular choice when it comes to webprogramming. Javascript is a client-side scripting language, which Perl and PHP for instance are server side.
If you need even more power to Javascript there are several premade libraries that offers a large range of extra features to javascript, one of the most popular of these are jQuery which is also completely free. jQuery isn’t supported by default in the webbrowsers so you will need to include it manually in your Javascript code.

A simple example of a Javascript embedded in HTML could look like this.

<html>
<head>
  <title>JavaScript example</title>
</head>
<body>
<script type="text/javascript">
  document.write("Hello Visitor and welcome to my Javascript page!")
</script>
</body>
</html>

This would write the text “Hello Visitor and welcome to my Javascript page!” on your webpage.