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

Undefined vs. Undeclared

The primitive undefined value represents the absence of a value... but it's not the same thing as an "undeclared" variable!

We can create an undefined variable by giving it a name, but no value:

let favoriteSandersonCharacter; // undefined
console.log(typeof favoriteSandersonCharacter); // "undefined"

However if we never create the name, it's "undeclared", and undeclared variables actually throw an error (so don't do this):

console.log(favoriteRothfussCharacter); // ReferenceError: favoriteRothfussCharacter is not defined

The worst part is that the undeclared variable error actually says "not defined"... welcome to JavaScript. 🤦‍♂️

As an aside, you can use const to declare a variable that is assigned to undefined, but you wouldn't be able to set its value later, so why would you want to?

const favoriteSandersonCharacter; // SyntaxError: missing = in const declaration
const favoriteSandersonCharacter = undefined; // undefined

Assignment

Create the missing variables used in the console.log calls so that they are declared but undefined. Make sure the code runs without errors.