Welcome to JavaScript Essentials! JavaScript is a programming language that powers the modern web, making websites interactive and dynamic. In this first lesson, you'll learn what JavaScript is, its core capabilities in the browser, and how to set up the simple tools you need to start coding.
JavaScript (often shortened to JS) is a programming language that was initially created to "make web pages alive". It's a high-level, interpreted language that follows the ECMAScript specification.
When you load a webpage, JavaScript code runs directly in your browser. It doesn't need to be compiled into a separate program. Along with HTML and CSS, JavaScript is one of the three core technologies of the World Wide Web.
Modern JavaScript is a "safe" language. It doesn't provide low-level access to the computer's memory or CPU. It was created for browsers, which don't require it.
JavaScript running in a browser can:
For safety reasons, JavaScript's capabilities in the browser are limited. This prevents an evil webpage from accessing private information or harming your data.
These limitations include:
site.com cannot access a page from othersite.com (though there are ways to work around this if both pages agree).There are three key things that make JavaScript a powerful and popular language:
These three features make JavaScript the most widely used tool for creating browser-based user interfaces.
To start learning, you only need two things: a modern web browser and a code editor.
Your browser already includes a JavaScript engine and essential developer tools.
Recommended Browsers:
You can write code in a simple text editor, but a specialized code editor makes your life much easier with features like syntax highlighting, code completion, and file management.
Popular Free Options:
The Developer Console is a panel inside your browser that is invaluable for development. You can use it to inspect errors, see log messages, and run JavaScript commands directly.
How to Open Developer Tools:
Once open, click on the "Console" tab.
Let's write "Hello, world!" using JavaScript.
<script> TagYou can add JavaScript directly into your HTML file using the <script> tag.
index.html.<!DOCTYPE html>
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<h1>My First JavaScript</h1>
<script>
alert('Hello, World!');
</script>
</body>
</html>

