Souvir Ly Souvir Ly - 4 months ago 12
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

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;