JavaScript is a cross-platform object-oriented scripting language used to create interactive web pages (e.g., using complex animations, creating clickable buttons, pop-up menus, etc.). Programs in this language are called scripts. They can be written directly in the HTML of a web page and run automatically when the page loads.
Why JavaScript?
The JavaScript language originally had a different name, “LiveScript”, but they decided to change it, because Java was very popular at the time, and the positioning of the new language as the “little brother” of Java only played into the hands of the people.
However, as it evolved, JavaScript became a completely independent language, with its own ECMAScript specification, and has nothing to do with Java anymore.
Why is JavaScript unique?
JavaScript is the most convenient tool for creating interfaces in the browser. And here’s why:
- Fully integrated with HTML / CSS.
- Supported by all major browsers and included by default.
- Allows you to make applications not only in browsers, but also on the server, on mobile devices, etc.
What can JavaScript do in a browser?
JavaScript in a browser can do everything related to manipulating a web page, interacting with the user and the web server. For example:
- Add new HTML code to a page, modify existing content, modify styles.
- Respond to user actions, mouse clicks, pointer movements, keystrokes.
- Send network requests to remote servers, download and upload files.
- Receive and set cookies, ask questions of the visitor, and display messages.
- Store data on the client side (“local storage”).
- Are JavaScript and Java the same thing?
Oh no. They are completely different languages, created by different teams for different tasks. The similarity in names is only due to a marketing move in the mid-1990s.
Java is a compiled language for creating software.
JavaScript is a scripting language for creating dynamic web pages, that is, web pages that display different content each time they are viewed.