How to compare if two objects are really the same object?

前端 未结 4 539
感情败类
感情败类 2020-12-08 11:57

I want to compare if an variable A represents the same object as variable B does.

Could I do that with the == operator?

Or what else is this exactly looking

4条回答
  •  轮回少年
    2020-12-08 12:20

    The two other answers correctly answer the question in your title. The correct answer to the completely different question in your body text, however, is: yes, the == operator is correct for testing whether two variables refer to the same object.

提交回复
热议问题