Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-20 23:02:01 +03:00
parent 52880f08ee
commit caa67e2a49
63 changed files with 175 additions and 126 deletions

View File

@ -3,15 +3,13 @@ title: isWeekend
tags: date,beginner
---
Results in a boolean representation of a specific date.
Checks if the given date is a weekend.
- Pass the specific date object firstly.
- Use `Date.prototype.getDay()` to check weekend based on the day being returned as 0 - 6 using a modulo operation then return a boolean.
- Use `Date.prototype.getDay()` to check weekend by using a modulo operator (`%`).
- Omit the argument, `d`, to use the current date as default.
```js
const isWeekend = (d = new Date()) => {
return d.getDay() % 6 === 0;
};
const isWeekend = (d = new Date()) => d.getDay() % 6 === 0;
```
```js