How is y defined? If you're storing values in an Array variable using string keys, then you're storing them as properties in the Object and not as elements in the Array.
Javascript code:
var a = [];
a[0] = "hello"; // stored as array element
Debug.Trace(a.length); // = 1, as you would expect
a["foo"] = "bar"; // stored as object property
Debug.Trace(a.length); // = 1, problem?
Debug.Trace(a.shift()); // = "hello", as you would expect
Debug.Trace(a.shift()); // = undefined, instead of the 'expected' "bar"
If you don't need any of the Array features such as .length, .pop() or .slice(), simply make it an Object:
Javascript code:
var y = {};
That way, you don't need any of those .hasOwnProperty() checks to skip any unwanted methods from the prototype, since Object.prototype should be empty.
It'd also help if you gave your variables decent names. How will you know what x[0] and y were when you look at your code again in a few months?