why in my script written why missing name after . operator when I've included a script like this
this.switch = function(){
if (this.status == "enabled")
{
this.disable();
this.stop();
}
else
{
this.enable();
}
}
the script is meant to divert status from enabled to disabled
switch
is a reserved keyword (for ... switch
statements!). If you imperatively, absolutely must use this name, write this['switch']
instead, but it will be annoying to use.
A common name for a function that turns something on/off is toggle()
.
switch
is a javascript keyword. Try using a different name for your function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With