📜  readonly vs const - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:12.109000             🧑  作者: Mango

代码示例1
in TS:
Both cannot be reassigned and effectively achieve the same thing.
However, because readonly is a typescript only thing, it only applies at compile time.

- use const for variables
- use readonly for properties