Are there any special measures needed to pass an object from one function to another? I am relatively new to Object Oriented JavaScript so forgive me if there is an easy fix. Here is some sample code for a problem I am having.
function foo {
    var x = 0;
    var y = 0;
    /* this is the JavaScript Object that is passed in
    cell = {
            left: {x: someInt, y: someInt},
            up: {x: someInt, y: someInt},
            right: {x: someInt, y: someInt},
            down: {x: someInt, y: someInt},
            x: someInt,
            y: someInt
        }
    */    
    this.turn = function(cell){
        console.log(cell);
        processNeighbors(cell);
        smartMove(x,y, cell);
    function smartMove(x,y,cell) {
         // make a smart decision
    }
    function processNeighbors(x, y, cell) {
        console.log(cell); // this is the line of the undefined error
        // process all neighbors
    }
}
I expected that both outputs would be the same, however, the console.log() inside the processNeighbors function returns a valid response and the bar function returns a 'cannot read property "value" of undefined. 
So when an object is passed from one function to the next, does it go out of scope? I don't change the object itself in any of functions.
 
    