Disabling an object in Js

I am trying to find out how to turn an object on and off in js. Example of what im looking for I have a shiled and I want it turned off unless the S key is pressed and when it is pressed again it turns it back off.

The documentation is good for this sort of thing. See: