[SOLVED] Simple key switch/toggle

What Am I Missing? Simple switch

if(app.keyboard.wasReleased(pc.KEY_X)){
    if (pressed == false)
        console.log('false');
    pressed = true; 

    } else {
console.log('true');
    pressed = false; 
    }

Search tags: key switch, toggle key, on off, enable, disable, with keyboard button
This is what you’re looking for:

  if(app.keyboard.wasReleased(pc.KEY_X) ){
if (this.cameraSwitch){
                this.cameraSwitch = false;
                  console.log("ON");
                return;
              
            }
            this.cameraSwitch = true;
                            console.log("OFF");
 }

You’re missing a { bracket after your first pressed statement and as far I can see, your missing a } bracket at the end.