- The program logic is => Set
click
eventlistener on the checkboxes, sethandleCheck
as callback fn. Declare a variable calledlastChecked
to store last checked input. Whathandlecheck()
does: it sets a variableinBetween
= false. When shifkey is pressed and the box is being checked, then loop over the checkboxes => if the checked box is the current one or lastChecked, then flip the value ofinbetween
.. IfinBetween
is true, set the checkbox to checked. Set the current checked checkbox aslastChecked
. Rinse and Repeat.