Repository navigation
JavaScript & TypeScript
JavaScript is an interpreted, dynamically typed, multi-paradigm, garbage-collected, single-threaded programming language, often used for developing client-side web applications. Adding features such as asynchronous filesystem access, native HTTP/QUIC support, cryptography, streams, buffers, etc are what results in a separate runtime named Node.js. Their syntax has no difference. Each browser such as Chrome, Edge, Safari, Firefox implements their own JavaScript engine such as V8, Chakra, Webkit, Spidermonkey following the ECMA-262 specification. However this results in differences among implementations for instance Chakra has a multi-threaded event loop 🤯. Note that despite JavaScript being asserted as an "interpreted" language, in truth, it is compiled through various approaches such as JIT on the fly right before executing it - making an impression of an interpreted language.
- Code is a set of special instructions to tell the computer what tasks to perform.
- Syntax are the rules of valid format and combinations of instructions.
- A statement is a group of expressions and operators that performs a specific task.
- Statements are made up of one or more expressions. In ECMA and MDN docs, expressions are often coupled with operators in the same section. Clearly because most expressions are made of operators.
- A variable is a container to hold a type and a value. Based on various aspects of a variable, languages are divided into the following.
- Strongly typed, meaning the compiler will not allow operations between variables.
- Weakly typed, meaning the compiler will allow and may automatically do type coercion.
- Statically typed, meaning variable types are explicitly mentioned during declaration at compile-time and will not change at runtime.
- Dynamically typed, meaning a variable can be assigned new values of different types at runtime.