Update snippet descriptions
This commit is contained in:
@ -3,10 +3,10 @@ title: isWeekday
|
||||
tags: date,beginner
|
||||
---
|
||||
|
||||
Results in a boolean representation of a specific date.
|
||||
Checks if the given date is a weekday.
|
||||
|
||||
- Pass the specific date object firstly.
|
||||
- Use `Date.prototype.getDay()` to check weekday by using a modulo operator and then returning a boolean.
|
||||
- Use `Date.prototype.getDay()` to check weekday by using a modulo operator (`%`).
|
||||
- Omit the argument, `d`, to use the current date as default.
|
||||
|
||||
```js
|
||||
const isWeekday = (d = new Date()) => d.getDay() % 6 !== 0;
|
||||
|
||||
Reference in New Issue
Block a user