Skip to content

Instantly share code, notes, and snippets.

@caglarorhan
Created September 6, 2025 04:05
Show Gist options
  • Save caglarorhan/e7f71a319f00cf295661b5780351cf10 to your computer and use it in GitHub Desktop.
Save caglarorhan/e7f71a319f00cf295661b5780351cf10 to your computer and use it in GitHub Desktop.
PowerBall - most drawn 10 white and 5 red numbers
// target page: https://www.powerball.com/previous-results?gc=powerball
let theList = [];
document.querySelectorAll('.card-body.ps-3.pe-4.pe-lg-5').forEach(draw => {
let drawData = draw.querySelector('.game-ball-group').innerText.split('\n');
theList.push(drawData);
});
// Beyaz ve kırmızı sayılar için sayaçlar
let whiteCounts = {};
let redCounts = {};
theList.forEach(draw => {
let whites = draw.slice(0, 5).map(n => parseInt(n));
let red = parseInt(draw[5]);
whites.forEach(num => {
whiteCounts[num] = (whiteCounts[num] || 0) + 1;
});
redCounts[red] = (redCounts[red] || 0) + 1;
});
// Obje → sıralı array dönüştürme
function sortCounts(countObj) {
return Object.entries(countObj)
.map(([num, count]) => ({ number: parseInt(num), count }))
.sort((a, b) => b.count - a.count); // çoktan aza
}
let sortedWhites = sortCounts(whiteCounts);
let sortedReds = sortCounts(redCounts);
console.log("Beyaz toplar (çoktan aza):");
console.table(sortedWhites);
console.log(sortedWhites);
console.log("Kırmızı toplar (çoktan aza):");
console.table(sortedReds);
console.log(sortedReds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment