Souvir Ly Souvir Ly - 1 year ago 65
Javascript Question

what doest this.allow = !1 and this.allow = !0 mean?

I tried to understand some code.
It begin like this :

function Drawing(varCanvas, varSize, varPrice) {
var c = this;
this.allow = !1;
this.size = varSize;
this.$canvas = varCanvas;
this.allow = !0;

I don't understand why the developer wrote "this.allow = !1;"
I never seen this writing before.

Thanks for your explanations.

Answer Source

To be honest I have never seen this myself, but its effect is:

!1 is the same as false

!0 is the same as true

so instead of this.allow = !1; you could write this.allow = false;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download