Statement var test_array = [];
creates a local variable which will not be visible outside the scope it is defined within. What you need here is the variable defined as the property of object instance. Use this
reference inside your test
function:
function test() {
this.test_array = [];
}
For more information on scopes in JavaScript read the documentation.