Truthy and Falsy Things

Estimated reading: 1 minute 53 views

Values that evaluate to true

				
					 ’0’;
 ’any string’; // an string
 []; // an empty array
 {}; // an empty object
 1; // any non-zero number
				
			

Values that evaluate to false

				
					0;
 ’’; // an empty string
 NaN; // JavaScript’s ”not-a-number” variable
 null;
 undefined; // be careful-- undefined can be redefined!
				
			
Share this Doc

Truthy and Falsy Things

Or copy link