Week 5, day 6
Started the weekend Bowling Scoresheet challenge late last night but when I carried on with it today I had major issues getting it to elegantly calculate the final score for a game. So I went back to the drawing board and scoured the web for design ideas. By the end of the day I was passing the basic requirements of the challenge and feeling confident about getting a web interface up and running so I could do some CSS.
One of the issues I faced was getting a concise way to re-run commands in tests. In ruby you can just use .times but we don't have that luxury in JavaScript.
bowling.roll(10);
bowling.roll(10);
bowling.roll(10);
bowling.roll(10);
bowling.roll(10);
bowling.roll(10);
...or...
function helper(rolls, pinsEachRoll){
for (var i = 0; i < rolls; i ++){
bowling.roll(pinsEachRoll);
};
};
helper(6, 10);
Above: How to create a helper function to create multiple actions, replicating .times in Ruby.
Written on April 18, 2015