custom function for manipulating builtin array

is there a way to write custom functions for manipulating builtin array of any type?

such as making the following function to accept any type:
funtion doublingArraySize(array:______){
array=new ______[array.length*2];
}

intArray:int=new int[1];
floatArray:float=new float[1];
doublingArraySize(intArray);
doublingArraySize(floatArray);
//intArray and floatArray can now contains 2elements each

if not possible, is it possible to write reusable code for manipulating builtin array?

You could do such things with C# & generics, e.g.:

void Foo<T>(T[] a) where T : new() {
    a[0] = new T();	
}

UnityScript/JavaScript however doesn’t let you write generic code, only use it.