Heather Rose wrote:I see what you are saying David, I am trying to have an array without defining a size (hence 'x').
I'm not really sure you do. If you define "numbers" as an
Array it isn't going to let you run it as a function. When you write
numbers(x) it's going to attempt to execute your array as a function, and it isn't one--it's an array. Firebug console:
If you're trying to add a number to the
numbers array, in other words the length of the array will increase by one every time you add a number, then you need to do something similar to:
Or, alternatively:
The second issue is the following:
This *overwrites* your array--now not only do you not have a function, you don't have an array anymore.
(Or at least you wouldn't if you weren't getting a JavaScript exception when you tried to execute an array.)