title: JSON.stringify produces empty object {}
body: <p>I try to get the value of an event object from Google Chrome (WebRTC framework). My method looks like this:</p>
  
  <pre><code>yourConnection.onicecandidate = function (event) {
      console.log("onicecandidate called on my side with event: "
          + JSON.stringify(event, null, 4)); //that last line produces {}
  
      var result = "";
      for (var key in event) {
          result += (key + " : " + event[key]);
      }
      console.log(result);
      //...
  }
  </code></pre>
  
  <p>While JSON.stringify does not work, the loop produces result like ...</p>
  
  <pre><code>  candidate : [object RTCIceCandidate], NONE : 0, CAPTURING_PHASE : 1, AT_TARGET : 2, BUBBLING_PHASE : 3, MOUSEDOWN : 1, MOUSEUP : 2, MOUSEOVER : 4, MOUSEOUT : 8, MOUSEMOVE : 16, MOUSEDRAG : 32, CLICK : 64, DBLCLICK : 128, KEYDOWN : 256, KEYUP : 512, KEYPRESS : 1024, DRAGDROP : 2048, FOCUS : 4096, BLUR : 8192, SELECT : 16384, CHANGE : 32768, type : icecandidate, target : [object RTCPeerConnection], currentTarget : [object RTCPeerConnection], eventPhase : 2, bubbles : false, cancelable : false, defaultPrevented : false, timeStamp : 246.52, path : , srcElement : [object RTCPeerConnection], returnValue : true, cancelBubble : false, stopPropagation : function stopPropagation() { [native code] }, stopImmediatePropagation : function stopImmediatePropagation() { [native code] }, preventDefault : function preventDefault() { [native code] }, initEvent : function initEvent() { [native code] }, composed : false, composedPath : function composedPath() { [native code] }, 
  </code></pre>
  
  <p>I don't really want to make things complicated and use recursion in order to get the subproperties of the properties. So is there no way to output the properties of the object in a nice and clean way? Why does JSON.stringify give me an empty object?</p>
  
  <p>Also, why can I only loop through an object using the for each loop, while</p>
  
  <pre><code> for (var i = 0; i&lt;event.length; i++) result += (event[i] + event[event[i]] );
  </code></pre>
  
  <p>does not iterate? I am new to Javascript, sorry if I am missing something.</p>