Add logical or
This commit is contained in:
18
snippets/or.md
Normal file
18
snippets/or.md
Normal file
@ -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
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user