JavaScript operator overloading for arrays and complex numbers