Created Truthy and Falsy (markdown)

Jun Yang
2017-04-20 19:46:07 +08:00
parent c38ba8f342
commit 5c5ff40bff
+22
@@ -0,0 +1,22 @@
Though [shopify-liquid][sl] is designed platform-independent, there're certain differences with [the Ruby version][ruby], one of which is the `truthy` evaluation.
Everything other than `false` and `nil` is truthy in the ruby version, see: <https://shopify.github.io/liquid/basics/truthy-and-falsy/>
In this JavaScript version, things are slightly different:
value | truthy | falsy
--- | --- | ---
`true` | ✔️ |
`false` | | ✔️
`null` | | ✔️
`undefined` | | ✔️
`string` | ✔️ |
`empty string` | ✔️ |
`0` | ✔️ |
`integer` | ✔️ |
`float` | ✔️ |
`array` | ✔️ |
`empty array` | ✔️ |
[ruby]: https://shopify.github.io/liquid
[sl]: https://www.npmjs.com/package/shopify-liquid