Open the suggestion that appears below the word box.
On the new screen, press F12.
Paste the code below, changing the instructed fields below.
const bodyText = document.body.innerText;
const requiredLetters = ['l']; // required letters
const notRequiredLetters = ['o', 'n']; // not allowed letters
const size = 4; // desired word size
// Split the text into words
const words = bodyText.match(/\b\w+\b/g);
// Filter the words that match the criteria
const matchingWords = words.filter(word => {
// Convert the word to lowercase to make the comparison case-insensitive
const lowercaseWord = word.toLowerCase();
// Check if the word is of the desired size
if (lowercaseWord.length !== size) {
return false;
}
// Check if it contains all required letters
if (!requiredLetters.every(letter => lowercaseWord.includes(letter))) {
return false;
}
// Check if it does not contain not allowed letters
if (notRequiredLetters.some(letter => lowercaseWord.includes(letter))) {
return false;
}
// If it passes all checks, the word is valid
return true;
});
console.log(matchingWords);