How to enable javascript in the browser - Instructions for all versions. What are JavaScripts? Basic Functions of JavaScript What is a java script and why is it needed
JavaScript® (often shortened to JS) is an interpreted programming language designed to interact with web pages. JavaScript runs on the client side of the web and is used to program how web pages will behave when certain events occur.
What is JavaScript?
JavaScript is a cross-platform, object-oriented scripting language that adds interactivity and responsiveness to your web pages.
JavaScript allows a website developer to control how a web page behaves. This makes JavaScript fundamentally different from HTML, the language that is responsible for the structure of a web document, and CSS, the language that shapes the appearance of web pages.
Programs written in JavaScript are called scripts. In the browser, they are connected directly to the HTML document and, as soon as the page is loaded, they are immediately executed. The process of executing a script is called "interpretation".
If the PHP script is processed on the server side using the PHP interpreter, then the JavaScript is executed in the user's browser by the JavaScript interpreter.
Today, every browser supports JavaScript, thus making it the language of the web.
In the browser, JavaScript can do everything related to manipulating the HTML document, interacting with the visitor, and, with some limitations, with the server:
- Validate that custom HTML forms are filled in correctly.
- Interact with webcam, microphone and other devices.
- Change styles of HTML elements, hide, show elements, etc.
- Display pop-ups and dialog boxes.
- Respond to visitor actions, handle mouse clicks, cursor movements, etc.
- Send requests to the server and download data without reloading the page.
JavaScipt is an incredibly powerful and efficient language that you should definitely try out!
JavaScript versus ECMAScript
This tutorial is written about the language known as JavaScript. However, the official standard that defines the specifications that describe the language calls it ECMAScript.
Netscape introduced the JavaScript language to Ecma International, an organization dedicated to standardizing information and communication systems (ECMA was originally an acronym for the European Computer Manufacturers Association), where it was approved as an ECMAScript standard in 1997.
This standardized version of JavaScript, called ECMAScript, works the same in all applications that support the standard. Developers can use the language's open standard to develop their own JavaScript implementation.
Formally, when developers refer to ECMAScript, they usually mean the "ideal" language defined by the Ecma standard. Most often, these two concepts are interchangeable. Therefore, when referring to the official standard in this tutorial, the name ECMAScript will be used, and in other cases, when referring to the language, JavaScript. The tutorial will also use the commonly accepted abbreviation ES5 when referring to the fifth edition of the ECMAScript standard.
JavaScript is not Java
Before you start learning JavaScript, you should understand that JavaScript is not Java. These are two completely different programming languages. JavaScript has nothing to do with the Java language other than a similar syntax.
Java is an object-oriented programming language developed by Sun Microsystems since 1991 and officially released on May 23, 1995. Java is a powerful and much more complex programming language, and you can write a wide variety of programs in it. For web pages, there is a special opportunity - writing applets.
An applet is a Java program that can be connected to HTML using the tag
JavaScript scripts are hosted within a web page and cannot exist separately from it. JS scripts do not require a compiler to execute, they are executed by the browser on the user's side. JS script is plain text and you can view the code with the naked eye - without any special software.
Java is a class-based language that is fast, secure, and reliable. Java's class-oriented model means that programs consist solely of classes and their methods. Class inheritance and strong typing in the Java language typically require tightly coupled object hierarchies. These requirements make Java programming more complex than JavaScript programming.
JavaScript is a lightweight programming language that has a simple syntax, specialized built-in functionality, and minimal requirements for creating objects. You do not need to declare variables, classes and methods. You don't have to worry about whether methods are public, private, or protected, and you don't have to implement interfaces. Variables, parameters, and return types of JS scripts are not explicitly typed.
What do you need to learn JavaScript?
Prior knowledge of JavaScript is not required, but since JavaScript resides within web pages and controls their dynamics, it is assumed that you are familiar with the basics of the HTML language, although the possibility of "parallel" and JavaScript is not ruled out.
Most JavaScript scripts are designed to "spice up" HTML, that is, the purpose of writing a script is to demonstrate how the page will change when the HTML tag parameter values change. Put together and properly formatted, these kinds of scripts are an example of a developed web application.
Before we start writing our first JavaScript program, it is very important to make sure that all the necessary tools are set up and in place.
When learning JavaScript, it's very important to run the examples provided in each lesson, modify them, and run them again to check how well you understand the material you've learned. This requires a JavaScript interpreter. Fortunately, as you already know, every web browser includes a JavaScript interpreter.
To write and execute JavaScript programs, it is enough to install any modern Internet browser (for example, Yandex, Internet Explorer, Mozilla Firefox or Google Chrome).
You'll see later in this tutorial that you can embed JavaScript code directly into HTML files, in tags.