Last active
November 12, 2018 17:37
-
-
Save bluejack/550300e5ca73188ba1c715cd9e43b9f2 to your computer and use it in GitHub Desktop.
Javascript array of arrays for Ian Brown
This file contains 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
var ballots[] | |
onEvent("submitBtn", "click", function(){ | |
var newBallot = [getNumber("rank1"), getNumber("rank2"), getNumber("rank3"), getNumber("rank4"), getNumber("rank5")] | |
ballots.push(newBallot) | |
console.log (newBallot) | |
console.log ("We now have " + ballots.length + " in our system!" | |
}); | |
// Here's a little sample to show how you might begin to tabulate the ballots... | |
function tabulateBallots() { | |
var len = ballots.length | |
var rankOneTotal 0; | |
for (var i = 0; i < len; i++) { | |
var b = ballots[i] | |
console.log(b) | |
rankOneTotal += b[0] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment