simple underscore.js projects, walk through, & tutorial
Lottery DataBase Analysis
California Lucky for Life (832)
Prize
Odds (1 in x)
$3,250,000 2,400,000
$5,000 1,200,000
$1,000
400,000
$500
12,000
$100
645
$40
350
$20
53
$15
40
$10
20
$5
11
$5 (Ticket)
10
Above is a raw odds chart.
Below is a JavaScript array for the same data.
var prizeAmount = [3250000,5000,1000,500,100,40,20,15,10,5,5];
document.getElementById('outputOne').innerHTML = _.map(prizeAmount, function(n){return ' $' + n;});
prizeAmount Output:
$3250000, $5000, $1000, $500, $100, $40, $20, $15, $10, $5, $5
var oddsAgainst = [2400000,1200000,400000,12000,645,350,53,40,20,11,10];
document.getElementById('outputTwo').innerHTML = _.map(oddsAgainst, function(n){return ' ' + n;});
oddsAgainst Output:
2400000, 1200000, 400000, 12000, 645, 350, 53, 40, 20, 11, 10
And here are the two combined as one object.
Got me as to the utility of this, but one does what one can as one circles towards a solution.
var game832 = _.object(oddsAgainst, prizeAmount);
document.getElementById('outputThree').innerHTML = JSON.stringify(game832);
Output:
{"10":5,"11":5,"20":10,"40":15,"53":20,"350":40,"645":100,"12000":500,"400000":1000,"1200000":5000,"2400000":3250000}
Please Note: I am an idiot. No seriously. The odds of my
gambling odds calculations being correct are likely on par with my odds
of ever winning. You have been warned.