mh108
7/21/2018 - 8:57 PM

rd.js

click handler for roll doubles app, CIS 111 P4 18U

// jshint esversion: 6

//helper function
let rollDoubles = n => {
  let d1,
    d2,
    rollcount = 0;
  //roll until double n's
  do {
    //...
  } while (d1 + d2 != 2 * n);

  return rollcount;
};

//when the button gets clicked, Who you gonna call
let clickHandler = function() {
  let count;

  //1. get value for n entered by user
  let n = Number(document.querySelector("input").value);

  //2. roll double n's

  //3. select img elements
  let imgArr = document.querySelectorAll("img");

  //4. set both img elements src property to display n-dot die

  //5. add rollCount to empty div on web page
};

//register the handler after the DOM is complete
window.addEventListener("load", function() {
  //select the button and register the handler
  document.querySelector("button").addEventListener("click", clickHandler);
});