Array
directly, you get and array of the base class Object
. Object
does not have a push()
method. In fact l, even the Array
class does not have a push()
method either. The push()
function is a C++ standard library thing, not a C# thing.string[]
.List<string>
.Since it is posted in Web Forms forums, it is probably Javascript.
Yeah, you call push on the array, not the item in the array (unless the item in the array is an array)cannt read property 'push' of undefined
filter.push( dt[I].id );
var filter = {}; // Use {} to create an object instead of new Array()
for (var i = 0; i < dt.length; i++) {
var dec = dt[i].desc;
if (!filter[dec]) {
filter[dec] = []; // Initialize the array if it doesn't exist
}
filter[dec].push(dt[i].id);
}