<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Truthy on Elliot Sachs</title><link>https://www.elliotsachs.com/tags/truthy/</link><description>Recent content in Truthy on Elliot Sachs</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>Copyright © 2026 Elliot Sachs</copyright><lastBuildDate>Sat, 18 Nov 2017 14:51:43 +0000</lastBuildDate><atom:link href="https://www.elliotsachs.com/tags/truthy/index.xml" rel="self" type="application/rss+xml"/><item><title>List of Falsy Values in JavaScript &amp; ToBoolean Algorithm</title><link>https://www.elliotsachs.com/list-of-falsy-values-in-javascript-toboolean-algorithm/</link><pubDate>Sat, 18 Nov 2017 14:51:43 +0000</pubDate><guid>https://www.elliotsachs.com/list-of-falsy-values-in-javascript-toboolean-algorithm/</guid><description>&lt;p&gt;Here&amp;rsquo;s a no frills post about the falsy values in JS. In case you didn&amp;rsquo;t know, JavaScript considers some values as truthy and other as falsy. Most are deemed truthy so it&amp;rsquo;s a lot easier to simply remember the falsy ones.&lt;/p&gt;
&lt;p&gt;You can see the truthy vs falsy evaluation in action when using an if statement. The statement takes in an expression and coerces it to a boolean value using the ToBoolean algorithm. The result is predictable and outlined in the table provided by the ECMAScript spec. Here it is below:
Argument TypeResultCompletion RecordIf argument is an abrupt completion, return argument. Otherwise return ToBoolean(argument.[[value]]).UndefinedReturn false.NullReturn false.BooleanReturn argument.NumberReturn false if argument is +0, −0, or NaN; otherwise return true.StringReturn false if argument is the empty String (its length is zero); otherwise return true.SymbolReturn true.ObjectReturn true.
So just to recap, the falsy values are:&lt;/p&gt;</description></item></channel></rss>