Clone and Equals methods for javascript objects