1

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Souvir Ly
  • 13
  • 4

1 Answers1

0

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;

TehSphinX
  • 6,536
  • 1
  • 24
  • 34