Facebook Pixel

Which is better: var, let, or const?

In modern JavaScript, let and const are generally preferred over var.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in What Is the Difference Between var, let, and const?

The variable reference cannot be reassigned, although object contents may still be modified.

No. var is function scoped.

No. let cannot be redeclared within the same scope.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.