Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Truth About Truthy & Falsy
Search
Swaroop SM
April 10, 2015
Technology
1
56
The Truth About Truthy & Falsy
Deck demonstrating which values are truthy / falsy w.r.t a programming language.
Swaroop SM
April 10, 2015
Tweet
Share
More Decks by Swaroop SM
See All by Swaroop SM
Client-Side Data Modelling and more...
swaroopsm
0
59
ReactJS Awesomeness
swaroopsm
3
260
Testing JavaScript like a "BOSS"
swaroopsm
0
61
Other Decks in Technology
See All in Technology
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
43k
現場データから見える、開発生産性の変化コード生成AI導入・運用のリアル〜 / Changes in Development Productivity and Operational Challenges Following the Introduction of Code Generation AI
nttcom
1
460
現場の壁を乗り越えて、 「計装注入」が拓く オブザーバビリティ / Beyond the Field Barriers: Instrumentation Injection and the Future of Observability
aoto
PRO
1
260
ゼロコード計装導入後のカスタム計装でさらに可観測性を高めよう
sansantech
PRO
1
130
From Natural Language to K8s Operations: The MCP Architecture and Practice of kubectl-ai
appleboy
0
180
OSSで50の競合と戦うためにやったこと
yamadashy
3
970
Wasmの気になる最新情報
askua
0
180
データ戦略部門 紹介資料
sansan33
PRO
1
3.8k
ソースを読むプロセスの例
sat
PRO
15
9.9k
AI時代におけるデータの重要性 ~データマネジメントの第一歩~
ryoichi_ota
0
710
AI時代の開発を加速する組織づくり - ブログでは書けなかったリアル
hiro8ma
1
300
混合雲環境整合異質工作流程工具運行關鍵業務 Job 的經驗分享
yaosiang
0
170
Featured
See All Featured
Making Projects Easy
brettharned
120
6.4k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6k
Optimizing for Happiness
mojombo
379
70k
The Cult of Friendly URLs
andyhume
79
6.6k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.7k
The Pragmatic Product Professional
lauravandoore
36
7k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
10
880
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
The Invisible Side of Design
smashingmag
302
51k
A better future with KSS
kneath
239
18k
Transcript
WTF (What’s Truthy Falsy) Swaroop SM Cybrilla Technologies
- TRUTHY: If the value isn’t literally “true” but evaluates
to true. - FALSY: If the value isn’t literally “false” but evaluates to false. What is it?
undefined 0 false “” null NaN nil [] {} true
True False None
var a = 0; if(a) { alert(“I’m TRUTHY :)”); }
else { alert(“I’m FALSY. Feel so proud. :D”); } The Confusion
TRUTHY - true - 0 - “” - [] -
{} Ruby FALSY - false - nil
Ruby on Rails present? - !blank? - 0 - true
blank? - nil - “” - [] - {} - false - whitespace
Python TRUTHY - True - 1 FALSY - False -
None - 0 - [] - “” - {}
JavaScript TRUTHY - true - “0” - [] - {}
FALSY - 0 - false - “” - undefined - null - NaN
Thank You! @smswaroop http://www.github.com/swaroopsm/truthy-falsy