Difference between let var and const in angular





difference between let, var, and const in angular
v    var variables value can be changed and re-declared within its scope. let variables value can be changed but not re-declared; const variables value can neither be updated nor re-declared.

v   They are all hoisted to the top of their scope but while var variables are initialized with undefined, let and const variables are not initialized.
v   var declarations are globally scoped or function scoped while let and const are block-scoped.
v   var and let can be declared without being initialized, const must be initialized during declaration.

Share this

Related Posts

Previous
Next Post »