How to test if two objects are the same with JavaScript?
<p>I need a function:  </p>

<pre><code>function isSame(a, b){
} 
</code></pre>

<p>In which, if a and b are the same, it returns true.<br>
, I tried <code>return a === b</code>, but I found that <code>[] === []</code> will return false.<br>
Some results that I expect this function can gave:  </p>

<pre><code>isSame(3.14, 3.14);  // true  
isSame("hello", "hello"); // true  
isSame([], []); // true  
isSame([1, 2], [1, 2]); // true  
isSame({ a : 1, b : 2}, {a : 1, b : 2}); //true  
isSame([1, {a:1}], [1, {a:1}]);  //true
</code></pre>
