Getting Started With JavaScript

You don’t have access to this lesson
Please register or sign in to access the course content.

What is Javascript ?

JavaScript (JS) is a lightweight object-oriented programming language that is widely used to script web pages. It is a full-featured interpreted language used to enable dynamic interactivity on websites when applied to HTML documents. JavaScript enables users to construct modern web applications to interact directly without having to reload the page repeatedly. Traditional websites use js to provide several forms of interaction and simplicity. In today’s world, JavaScript is able to execute not only on the browser, but also on the server, or, in fact, on any device that has a JavaScript engine.

JavaScript History

JavaScript was invented by Brendan Eich in 1995. It was developed for Netscape 2 and became the ECMA-262 standard in 1997. The Mozilla foundation continued developing JavaScript for Firefox after Netscape handed JavaScript over to ECMA.  The first browser that supported ECMA-262 Edition 1 (ES1) was Internet Explorer 4 (IE4). There are many programmers who think that JavaScript and Java are the same. Java is a very complex programming language whereas JavaScript is only a scripting language. The syntax of JavaScript is mostly influenced by the programming language C.

How To Run JavaScript?

Being a scripting language, JavaScript cannot run on its own. In fact, the browser is responsible for running JavaScript code. When a user requests an HTML page that contains JavaScript, the script is sent to the browser for execution. One of the main advantages of JavaScript is that all modern web browsers support it. Therefore, you don’t need to worry about whether your site visitor uses Internet Explorer, Google Chrome, Firefox, or another browser. Also, JavaScript runs on any operating system including Windows, Linux, or Mac. Thus, JavaScript overcomes the main disadvantages of VBScript (Now deprecated) which is limited to just IE and Windows.

Hello World Example:

The JavaScript code should be written within <script> tags if all the code is included in the HTML document. This helps your browser distinguish your JavaScript code from the rest of the code.

<html>
<head>
	<title>My First JavaScript code!!!</title>
	<script>
		alert("Hello World!");
	</script>
</head>
<body>
</body>
</html>

Create a test.html file in any location and save the above code. Then, a dialog box will appear with the message "Hello World".

Congratulation, you just learn basic detail about javascript.