Add logical not
This commit is contained in:
17
snippets/not.md
Normal file
17
snippets/not.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
title: not
|
||||||
|
tags: math,logic,beginner
|
||||||
|
---
|
||||||
|
|
||||||
|
Returns the logical inverse of the given value.
|
||||||
|
|
||||||
|
Use the logical not (`!`) operator to return the inverse of the given value.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const not = a => !a;
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
not(true); // false
|
||||||
|
not(false); // true
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user