title: TypeError: expect(...).not.toBe is not a function
body: <p>Doing an exercise where I re-implement some functionality found in the Jasmine test framework.  Specifically, I am running this line:</p>
  
  <p><code>expect(false).not.toBe(true)</code></p>
  
  <p>and I get a TypeError saying that toBe does not exist as a function.  However, this line:</p>
  
  <p><code>expect(true).toBe(true)</code></p>
  
  <p>Passes.  I suspect that it's an issue with my not() function returning this.</p>
  
  <pre><code>function ExpectedValue (val) {
      this.value = val;
      this.notted = false;
  
      this.not = function() {
          this.notted = !this.notted;
          return this;
      }
  
      this.toBe = function(b) {
          if (this.notted) {
              return this.value !== b;
          }
          else {
              return this.value === b;
          }
      }
  }
  
  function expect(a) {
      return new ExpectedValue(a);
  }
  
  console.log(expect(false).not.toBe(true));
  </code></pre>