I have an object called Grid
and I use new
in order to create instances of it. I would like to be able to call its methods from the outside.
This is the (simplified) object:
var Grid = function() {
this.table = createTable();
function createTable() {
// ...
};
function setSelectedLine(line) { // this one should be public
// ...
};
};
var g = new Grid();
g.setSelectedLine(anyLine); // TypeError: g.setSelectedLine is not a function
I've found other topics with similar questions, but they use very different object constructions. Is it possible to make that method public without having to rewrite everything? The real object is actually bigger than that.