Answers for "readonly vs const"

1

readonly vs const

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
Posted by: Guest on May-10-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language