Q: Simple Class Function Boolean Output I want to make a class function that displays a variable of type boolean. How do I do this? I'm not even sure what I'm doing up to this point.
  <body>

   <div class="output"></div>

   <script type="text/javascript">

     var car = "ferrari";
     var garage = 52;

       class blue {

         constructor(fire) {
           if(2>5) {
             getElementsByClass('output').innerHTML = car;
           }
           else {
             getElementsByClass('output').innerHTML = garage;
           }
         }
       }
   </script>

  </body>


A: You need to use document.getElementsByClassName and pass the index 0 since it returns a nodelist.
Secondly invoke Blue class using new operator. Convention is class or constructor function is pascal case


var car = "ferrari";
var garage = 52;

class Blue {
  constructor(fire) {
    if (2 > 5) {
      document.getElementsByClassName('output')[0].innerHTML = car;
    } else {
      document.getElementsByClassName('output')[0].innerHTML = garage;
    }
  }

}

let k = new Blue('testFire')
<div class="output"></div>


