JAVASCRIPT: Basics



An Introduction to JavaScript

JavaScript is one of the most widely used programming languages in web development. It enables dynamic behavior on websites, transforming static HTML and CSS into interactive user experiences.

A Brief History
JavaScript was created in 1995 by Brendan Eich while working at Netscape Communications Corporation. Originally named Mocha, it was later renamed to LiveScript and then finally to JavaScript. Despite its name, JavaScript is not related to Java; the name was chosen due to Java's popularity at the time. JavaScript quickly became a standard for web development and was formally adopted by the European Computer Manufacturers Association (ECMA) as ECMAScript in 1997.

Purposes of JavaScript
JavaScript serves multiple purposes in web development:

An Interpreted Language
Programming languages can generally be categorized as interpreted or compiled: JavaScript is an interpreted langauge.

Including JavaScript in a Web Page
JavaScript can be included in an HTML document using the <script> element. Unless the script is external, it is best to make the script tag the last item in the body, so that all html content loads prior to the script running. Here is an example of a basic web page with script tags:
<!DOCTYPE html>
<html>
<head>
    <title>Inline JavaScript Example</title>
</head>
<body>
    <h1 id='target'>Hello, World!</h1>
    <script>
        document.getElementById('target').innerHTML = 'Hello, JavaScript!';
    </script>
</body>
</html>