This document is introduction to Javascript.
- What is Javascript
- Javascript categorization
Javascript is used on nearly all websites and it is what makes them interactive, what makes them feel alive.
Most common example is playing video, logging in to website, putting things in shopping cart or playing games in browser - without Javascript none of these will work.
Javascript is sometimes referred as ECMAScript. ECMAScript is a specification or a standard for scripting language known as Javascript.
Basic categorization is that Javascript is scripting language which is interpreted at runtime by Javascript engine (for example V8).
Though this interpretation is not 100% accurate as Javascript is using JIT (just-in-time compilation) which compiles script to binary so it can run faster.
Javascript is weakly typed system. And there is no static or runtime type checking. That means that system allows code such as:
let x = 42 - "13"; // 29
and it is valid syntax and runtime execution.
Javascript is passing so called Duck test - "If it walks like a duck and it quacks like a duck, then it must be a duck" - this means that object can be used as give type if it is not that type as long as it has all properties and functions as that type.
Note: This allows way more freedom when working with objects but also removes safe net when working with given type as unrelated object may by pure chance pass as correct type. More on this later.