We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

let and const

var is the old way to declare variables in JavaScript. Use let when reassignment is allowed and const when it isn't:

// username can be reassigned, so we use `let`
let username = "dengar_the_bh";
username = "boba_fett";

// smsSendingLimit can't be reassigned, so we use `const`
const smsSendingLimit = 1000;

var is function-scoped, so a variable declared inside an if block can leak outside it! let and const are block-scoped, which is always usually what you want.

Assignment

The code as-is sends two birthday messages (oops) instead of a welcome message and a birthday message!