mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
1.1 KiB
1.1 KiB
title
| title |
|---|
| Truthy and Falsy |
Though Liquid is platform-independent, there're certain differences with the Ruby version, one of which is the truthy value.
The Truth Table
According to Shopify document everything other than false and nil is truthy. But in JavaScript we have a totally different type system, we have types like undefined and we don't differentiate integer and float, thus things are slightly different:
| value | truthy | falsy |
|---|---|---|
true |
✔️ | |
false |
✔️ | |
null |
✔️ | |
undefined |
✔️ | |
string |
✔️ | |
empty string |
✔️ | |
0 |
✔️ | |
integer |
✔️ | |
float |
✔️ | |
array |
✔️ | |
empty array |
✔️ |