From 15cbf6bdfc8cb7c9ea92f6e7b86ae43a8e4a156e Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 13 May 2020 11:35:41 +0300 Subject: [PATCH] Add logical or --- snippets/or.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 snippets/or.md diff --git a/snippets/or.md b/snippets/or.md new file mode 100644 index 000000000..49fc6db08 --- /dev/null +++ b/snippets/or.md @@ -0,0 +1,18 @@ +--- +title: or +tags: math,logic,beginner +--- + +Returns `true` if at least one of the arguments is `true`, `false` otherwise. + +Use the logical or (`||`) operator on the two given values. + +```js +const or = (a, b) => a || b; +``` + +```js +or(true, true); // true +or(true, false); // true +or(false, false); // false +```