var, let, const and readonly`
There are two types of scopes in javascript, that is:
- Local scope(Function scope)
- Global scope
Variable declared as let has a local scope while var has a global scope.
Variable declared as const is a constant.
Property use readonly while variable use const.
interface vs class
classis a concept in javascript, whileinterfaceonly exists in typescript. The typescript compiler use interface solely for type checking.- interfaces which has same name will merge
Reference
- https://stackoverflow.com/questions/43055682/relationship-between-a-typescript-class-and-an-interface-with-the-same-name
- https://www.typescriptlang.org/docs/handbook/interfaces.html