One Way to Cheat Wordle using Javascript

ozboware

ozboware

Posted on January 25, 2022

One Way to Cheat Wordle using Javascript

After creating my own version of Wordle I took a look at the code behind the original Wordle game to check for similarities and found that it's pretty easy to cheat the game and get not only the word of the day, but every word for the next 5 years. Now, the simplest way to cheat is to just look at the script, but the dev in me just wanted to do more, so I created a function that will push an alert to the screen showing the player the word of the day. It's a simple enough function, you can either paste it in the console (F12, click console, paste and then enter), or you could use it in a browser extension and have the alert each time you go onto the page, you could possibly even wrap it up in a .exe file and run it locally.

So the code is

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());
    });
Enter fullscreen mode Exit fullscreen mode

go to the Wordle screen, paste that code into the console, submit it and an alert will pop up telling you the wordle of the day or something like

Wordle cheat demonstration

💖 💪 🙅 🚩
ozboware
ozboware

Posted on January 25, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

One way to make wordle using Javascript
javascript One way to make wordle using Javascript

January 29, 2022

One Way to Cheat Wordle using Javascript
javascript One Way to Cheat Wordle using Javascript

January 25, 2022