Saltar al contenido principal

Sort values by type before truthiness

Classify common JavaScript values by their type and common condition-check risk.

javascript-basics4 min read

Place each value or check into the bucket that describes the main risk when using it in a condition. Valid zero or empty-looking value Missing or not assigned Object reference Explicit boolean 0 as a quantity '' from an optional note field undefined from a missing property null returned for no selected user [] from an empty result list {} from an empty settings object false from an unchecked checkbox true from a feature toggle

Read the full lesson

Sign up free: one personalized lesson every day, matched to your role and goals.

← Back to library

Contáctanos