Unexpected initialization return value when initialising inside an Object
Unexpected initialization return value when initialising inside an Object
I put the dataTable function initialization inside an object but I don't get the same result as when I initialize it outside the object
Initialization outside object
[code]var dataTable = $('datatable').dataTable();[/code]
Initialization inside object
[code]
var aObject = {
dataTable : null,
initFunction : function() {
// this.dataTable contents is not the same when I initialize dataTable outside the object
this.dataTable = $('datatable').dataTable();
}
}
[/code]
Why is this?
Initialization outside object
[code]var dataTable = $('datatable').dataTable();[/code]
Initialization inside object
[code]
var aObject = {
dataTable : null,
initFunction : function() {
// this.dataTable contents is not the same when I initialize dataTable outside the object
this.dataTable = $('datatable').dataTable();
}
}
[/code]
Why is this?
This discussion has been closed.
Replies