One Way to Cheat Wordle using Javascript

One Way to Cheat Wordle using Javascript

·

2 min read

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.powerlanguage.co.uk/wordle/main.e65ce0a5.js")
    .then(x => x.text())
    .then(y => {
        let wordArray = y.slice(y.indexOf('var La='), y.indexOf(',Ta='))
            .replace('var La=', '')
            .replace('[', '')
            .replace(']', '')
            .replace(/"/g, '')
            .split(',');
        alert('The word for today (' + dayName + ' ' + day + '/' + month + '/' + year + ') is ' + wordArray[days].toUpperCase());
    });

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