function clearAll() {
  let images = document.getElementsByTagName("img");

  // If game is running, stop it
  if (gameRunning) stop();

  // Since removing nodes continually updates the node list, we have to keep removing the first node until there isn't one
  for (let i = 0, len = images.length; i != len; ++i) {
    images[0].parentNode.removeChild(images[0]);
  }

  //clear the array
  pacMen.length = 0;
}
//  clear all pacmans from the gamespace
clear all pacmans from the gamespace
clear all pacmans from the gamespace
function clearAll() {
  let images = document.getElementsByTagName("img");
  if (gameRunning) stop();
  for (let i = 0, len = images.length; i != len; ++i) {
    images[0].parentNode.removeChild(images[0]);
  }
  pacMen.length = 0;
}
function clearAll ( ) { let images = document . getElementsByTagName ( "img" ) ; if ( gameRunning ) stop ( ) ; for ( let i = 0 , len = images . length ; i != len ; ++ i ) { images [ 0 ] . parentNode . removeChild ( images [ 0 ] ) ; } pacMen . length = 0 ; }
clear all pacmans from the gamespace
clear all pacmans from the gamespace
// If game is running, stop it // Since removing nodes continually updates the node list, we have to keep removing the first node until there isn't one //clear the array