Created
September 6, 2025 04:05
-
-
Save caglarorhan/e7f71a319f00cf295661b5780351cf10 to your computer and use it in GitHub Desktop.
PowerBall - most drawn 10 white and 5 red numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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