From 5c5ff40bff030b58c68ff94a4b0cd607c42c2a3c Mon Sep 17 00:00:00 2001 From: Jun Yang Date: Thu, 20 Apr 2017 19:46:07 +0800 Subject: [PATCH] Created Truthy and Falsy (markdown) --- Truthy-and-Falsy.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Truthy-and-Falsy.md diff --git a/Truthy-and-Falsy.md b/Truthy-and-Falsy.md new file mode 100644 index 0000000..44acbb7 --- /dev/null +++ b/Truthy-and-Falsy.md @@ -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: + +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 \ No newline at end of file