javascript variable access error
<p>I have the code snippet below:  </p>

<pre><code>var ret_ = function(x){
    return x;
}
var make_cps=function(x,c_){
    return c_(x);
}
var pred = {
    _position: 0,
    setPosition: function (i) {
        _position = i
    },
    getPosition: function () {
        return _position
    },
    _size: 0,
    setSize: function (i) {
        _size = i
    },
    getSize: function () {
        return _size
    },
    _context: null,
    setContext: function (x) {
        _context = x
    },
    run: function () {
        return function (c_) {
            return make_cps(_position, c_);
        }(ret_) == 2;
    }
}    
</code></pre>

<p>When I run it like below, it runs correctly:  </p>

<pre><code>pred.setPosition(2)  
pred.setSize(10)  
pred.setContext(null)  
var res = pred.run()  
console.log(res)  // Output: true
</code></pre>

<p>but if I replace the <code>_position</code> to <code>getPosition()</code> an error occurs as <code>getPosition()</code> is not defined. Also if I change to <code>this.getPosition()</code> it says <code>this</code> doesn't have a member called <code>getPosition()</code>  </p>

<pre><code>var pred = {
    _position: 0,
    setPosition: function (i) {
        _position = i
    },
    getPosition: function () {
        return _position
    },
    _size: 0,
    setSize: function (i) {
        _size = i
    },
    getSize: function () {
        return _size
    },
    _context: null,
    setContext: function (x) {
        _context = x
    },
    run: function () {
        return function (c_) {
            return make_cps(this.getPosition(), c_); // gives Error here
        }(ret_) == 2;
    }
}    
</code></pre>

<p>Please someone throw light on this issue.  </p>
