Skip to main content

Undefined

Info:

  • In JavaScript, a variable without a value, has the value undefined. The type is also undefined.

    let car;    // Value is undefined, type is undefined
  • Any variable can be emptied, by setting the value to undefined. The type will also be undefined.

    car = undefined;    // Value is undefined, type is undefined

Danger:

  • An empty value has nothing to do with undefined.

    let car = "";    // The value is "", the typeof is "string"