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