-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
21 lines (21 loc) · 942 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
let date = new Date();
let dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
let dayName = dayNames[date.getDay()];
let day = date.getDate();
let month = date.getMonth() + 1;
let year = date.getFullYear();
let today = month + "/" + day + "/" + year;
let startDate = new Date("06/19/2021");
let endDate = new Date(today);
let days = Math.floor((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));
fetch ("https://www.nytimes.com/games/wordle/main.4951a4aa.js")
.then(x => x.text())
.then(y => {
let wordArray = y.slice(y.indexOf('var Ma='), y.indexOf(',Oa='))
.replace('var Ma=', '')
.replace('[', '')
.replace(']', '')
.replace(/"/g, '')
.split(',');
alert('The word for today (' + dayName + ' ' + day + '/' + month + '/' + year + ') is ' + wordArray[days].toUpperCase());
});