How to test if two objects are the same with JavaScript?

前端 未结 5 2005
慢半拍i
慢半拍i 2021-02-15 17:35

I need a function:

function isSame(a, b){
} 

In which, if a and b are the same, it returns true.
, I tried return a === b, b

5条回答
  •  情深已故
    2021-02-15 18:02

    the best way to do that is to use a JSON serializer. serialize both to string and compare the string.

提交回复
热议问题