## Static/Dynamic typing
Static/Dynamic typing is about *when type information is acquired* (either
at compile-time or at runtime).
More concretely, statically typed languages require knowledge of what data type each variable holds.
### Dynamically-typed
JavaScript is a dynamically-typed language, which means variables **do not** have a type.
These variables get assigned a type at runtime:
```js
let hello = 2;
hello = 'world';
```
This speeds the JavaScript development cycle, but is less efficient than statically typed languages at runtime.
## Strong/Weak typing
Strong/Weak typing is about *how strictly types are distinguished* (e.g. whether the language tries to do implicit conversion from strings to numbers). This conversion is often referred to as ‘type coercion’.
### Weakly-typed
JavaScript is weakly-typed. What happens below?
```js
function add(a, b) {
return a + b;
}
add(1, 'cat'); //➞ '1cat'
```
**Static typing**: variable types are known at *compile time* and must be specified when the variable is declared
**Dynamic typing**: variable types are determined at *runtime* and do not need to be specified in advance.
**Strong typing**: a variable's type *cannot* be changed after declaration
**Weak typing**: a variable's type *can* be changed after declaration
___
**Tags**: #types