I tried to override the toString() but i found that, overridden function in not getting called at all.
I have gone through this and this, but i am not able to track my mistake.
My attempt:
DIRECTION = {
    NONE : 0,
    DIAGONAL: 1,
    UP: 2,
    LEFT: 3
};
var Node  = function () {
    this.direction =  DIRECTION.NONE;
    this.weight = 0;
};
Node.prototype.toString = function NodeToSting(){
    console.log('Is called');
    var ret = "this.weight";
    return ret;
};
(function driver(){
    var node1 = new Node();
    console.log(node1);
    //findLcs("ABCBDAB", "BDCABA");
})();
Output:
{ direction: 0, weight: 0 }
 
     
    