
/* This defines a function which turns off every light by removing the "on" class from the HTML elements.*/

var TERMS = document.getElementsByClassName("term");

function allOff() {
  for (var i=0; i<TERMS.length; i = i+1) {
    TERMS[i].classList.remove("on");
  }
}

// switch term has been called! 
function switchTerm(target_class) {
   console.log(target_class); // what was passed in...?
// in this situation target_class is equal to "program"

allOff();

  // at this time lets create a list/array containing ONLY the target elements we want to "turn on"
  var target_nodes = document.getElementsByClassName('target_class');// need a way to search HTML page for all elements with className "program"

  // use a for loop to iterate over that sub-list
  // review this link for how to loop over node list...see EXAMPLE section
  // https://developer.mozilla.org/en-US/docs/Web/API/NodeList
 // for ( ...set up the for loop... ) { 
   //   target_node[i].classList.add("on"); // "turn on" each of those nodes!
  for (var i=0; < target_class.length; i ++) ) { 
  target_class[i].classList.add("on"); // "turn on"
  }

@@ -261,18 +261,17 @@
 %22);%0A  %7D%0A
-%7D
 %0A
+
 %0A// swit
@@ -444,17 +444,16 @@
 rogram%22%0A
-%0A
 allOff()
@@ -454,17 +454,18 @@
 lOff();%0A
+%7D
 %0A
-
   // at 
@@ -609,17 +609,16 @@
 assName(
-'
 target_c
@@ -625,9 +625,8 @@
 lass
-'
 );//
@@ -891,17 +891,16 @@
 List%0A //
- 
 for ( ..
@@ -1107,13 +1107,41 @@
 turn on%22
-%0A  %7D
+ each of those nodes!%0A  %7D%0A%0A %0A%0A%0A%0A
 %0A

Update lights.js