Nest all content into snippets
This commit is contained in:
21
snippets/js/s/is-even.md
Normal file
21
snippets/js/s/is-even.md
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Number is even
|
||||
type: snippet
|
||||
language: javascript
|
||||
tags: [math]
|
||||
cover: by-the-lighthouse
|
||||
dateModified: 2020-10-20T23:02:01+03:00
|
||||
---
|
||||
|
||||
Checks if the given number is even.
|
||||
|
||||
- Checks whether a number is odd or even using the modulo (`%`) operator.
|
||||
- Returns `true` if the number is even, `false` if the number is odd.
|
||||
|
||||
```js
|
||||
const isEven = num => num % 2 === 0;
|
||||
```
|
||||
|
||||
```js
|
||||
isEven(3); // false
|
||||
```
|
||||
Reference in New Issue
Block a user