Create .equals() method on javascript objects