Undefined is a value or state that represents a variable, property, or expression that has no assigned value.

Undefined is especially common in JavaScript.

For example:

let value
console.log(value) // undefined

Undefined is different from null in languages that distinguish them. Null usually means intentional absence, while undefined often means no value has been assigned or no property exists.

Undefined commonly appears when:

  • A variable is declared but not assigned
  • An object property does not exist
  • A function does not explicitly return a value

Some languages avoid undefined as a normal value and instead use null, optional types, or compile-time errors.

Anki

id: undefined-definition deck: Computer Science::Data Types tags: data-types undefined

Q: What is undefined? A: Undefined is a value or state for a variable, property, or expression that has no assigned value.

id: undefined-vs-null deck: Computer Science::Data Types tags: data-types undefined null

Q: How is undefined different from null? A: Null usually means intentional absence, while undefined often means no value has been assigned or no property exists.