JavaScript Cheatsheet
JavaScript Interview Questions
Things to learn:
- this
- Promises and async programming
- Closures
- Prototyping system and inheritance
JavaScript Background
Some properties of the language:
- Interpreted language.
JavaScript is an interpreted language, like Python. The browser directly reads and executes JavaScript source code rather than compiling it
- Dynamically typed language and weak type system.
JavaScript is a dynamic language (as opposed to a static language like C/C++) with a weak typing system. This means that variables can take on completely different types during runtime whereas in a static language like C++, the variables’ type are fixed on declaration and only have some typecasting flexibility.
"2" + 3 == 5
is true and so is 1 == "1"
. Being a weakly typed language means there is a greater number of unpredictable results at runtime.
- In general, static languages optimise hardware efficiency and type safety, but dynamic languages offer powerful flexibility and are easier to use.
ECMA
ECMA International (European Computer Manufacturers Association) is an organisation responsible for writing the JavaScript standards so that all browsers can interpret the same JavaScript code and run in exactly the same way. A big caveat is that the standards don’t dicate how the JavaScript runs, so that is left to the browser to decide!
ECMAScript — a standard document of specifications for JavaScript's language features. ECMAScript standards exists for ensuring the portability of JavaScript — similar in spirit to the POSIX standards for Shell, or SQL for DBMS languages
- 'ECMAScript' and 'JavaScript' are often used interchangeably.
- ECMAScript timeline and features