The community is working on translating this tutorial into Danish, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".
What is JavaScript?
JavaScript (often referred to simply as "JS") is a programming language based on the ECMAScript specification. It was created with the intention of making the web more alive by allowing you to manipulate the elements of a webpage after the browser had rendered them.
Today, that sounds so simple and trivial, but it was a huge thing when JavaScript was introduced in one of the very first webbrowsers, Netscape Navigator, back in 1997. Before that, webpages was all about layout and text and everything delivered as static content to the browser, not to be changed before you navigated to another page. JavaScript changed all that, and together with HTML and CSS, websites started the evolution into the highly dynamic version we know today.
The JavaScript language
A lot of things can be said about the JavaScript language, many of them in comparison to other programming languages. If you're completely new to programming, this information might not mean anything right now, but it will later on:
- JavaScript has half of it's name, and a lot of it's syntax style from the Java programming language, but don't get them mixed up - they differ quite a bit in a lot of important areas.
- JavaScript is weakly typed, meaning that you don't have to declare a variable as a specific type. Instead, the interpreter will guess it based on how you use it.
- JavaScript is dynamic - if you have a number variable, e.g. an integer, you can change it to a string simply by assigning text to it.
- JavaScript is prototypal, meaning that it's object orientation is based on prototypes instead of classes. We will dig more into that later on.
- JavaScript is functional, so functions are first-class and actually considered an object, allowing it to have properties and methods.
- JavaScript offers runtime evaluation, which means that you can take a text string of JavaScript code and have it evaluated by the interpreter as if it was a part of the original code.
These are just some of the facts about JavaScript. Hopefully this tutorial will be able to give you the full picture of what JavaScript is and how it works.