I've been coding javascript like this:
var Foo = {
something: function() {
},
someValue: 0,
someArray: [],
someObject: {},
anotherFunction: function (id) {
this.someArray.push(id); // works - adds value to array someArray
},
removeSomething: function(id) {
this.someArray.without(id); // doesn't work - value remains in array someArray
}
};
If in one of these functions, I push a value onto someArray (defined as []), it appears in the array, but I can't remove it using Array.without(). On checking with typeof, I found that it is an object, even though it's obviously an array. Whether there is some fundamental understanding to which I'm not aware, I'll leave that up to you to decide.
I would really like to push and pop (without) elements off this array while it's being treated like an array. Why is this being treated like an object and not an array?