Array indices start at zero in JavaScript. When x starts at 1, there's an undefined element in the first position of the array. Start at x=0 instead.
There's a better way to do this, however. Instead of manually keeping track of the last element in the list, you can just use Array.push() to add a new element onto the end.
var object_number = [];
function create_new_object()
{
object_number.push(new happy_object());
}
When you want to find out how many elements are in the array, use Array.length (or the number returned by Array.push()).
Further reference: Array @ MDC.
create_new_object()?object_number[0]? because you are settingx=1so index 0 will be undefined if you are trying to access it.happy_object? (Seriously, this reduced test case has been reduced too far to possibly work, it doesn't even have a line of code that could have anything come up as 'undefined')