What's the difference between let and const in JavaScript?

Ask Question
Asked 3 days agoViewed 1.7k times
15

When should I reach for one over the other? Are there performance implications I should know about?

MW
asked 3 days agoMarcus Webb7,334

3 Answers

  • Accepted answer

    const cannot be reassigned; let can. Both are block-scoped. There is no meaningful performance difference between them.

    LO
    answered 3 days agoLiam OConnor2,940
  • Note const still allows mutating the object it points at — it only freezes the binding, not the value.

    PN
    answered 3 days agoPriya Nair6,386
  • Prefer const by default; reach for let only when you genuinely reassign. It makes intent clearer to readers.

    MW
    answered 3 days agoMarcus Webb7,334

Your Answer