Toggle button, how to handle button state?

I’m trying to rebuild my drum machine on vanila JS
and I have added toggle button which will off or on app.

Question is such how I can to handle my toggle button state?
because now in the console
Now my project look so and in the console I can not find any property to handle On and Off state

Could put an onclick function on the button

myFunction() {
  if(button == 'on') {
    //make drum machine active
    //turn off drum machine/make inactive
1 Like