I have an js object
var myClass = Class.extend({
_innerArr: [],
add: function( id, url ){
this._innerArr.push([id, url]);
},
delete: function( id ){
$( this._innerArr ).each(function( index ){
if ( $( this )[0]==id ){
this._innerArr.splice( index, 1); // Doesn't work!!! Uncaught TypeError: Cannot call method 'splice' of undefined
}
});
}
});
But, if code change on:
var globalArr;
var myClass = Class.extend({
_innerArr: [],
add: function( id, url ){
this._innerArr.push([id, url]);
},
delete: function( id ){
globalArr = this._innerArr;
$( this._innerArr ).each(function( index ){
if ( $( this )[0]==id ){
globalArr.splice( index, 1); // Work!!!
}
});
}
});
why this._innerArr not work? I don't want using adding variable in my project. Thinks, other way is...