What is var?

The var keyword creates a function-scoped variable, and can lead to unexpected behavior when used inside blocks.

The let and const keywords are block-scoped, and should be preferred for modern TypeScript/JavaScript development.

Loading TypeScript...

Was this page helpful?