Javascript: Iterate through binary tree?
<p>How can I iterate through the following if I want to print all the pitches in order such that the left comes first and then right. For the following first piece of code; the answer should be a4, b4,c4,d4. How can I achieve this programmatically?</p>

<pre><code>var melody2_mus = 
    { tag: 'seq',
      left: 
       { tag: 'seq',
         left: { tag: 'note', pitch: 'a4', dur: 250 },
         right: { tag: 'note', pitch: 'b4', dur: 250 } },
      right:
       { tag: 'seq',
         left: { tag: 'note', pitch: 'c4', dur: 500 },
         right: { tag: 'note', pitch: 'd4', dur: 500 } } }
</code></pre>

<p>Another Example:</p>

<pre><code> var melody2_mus = 
        { tag: 'seq',
          left: { tag: 'note', pitch: 'b4', dur: 250 } },
          right:
           { tag: 'seq',
             left: { tag: 'note', pitch: 'c4', dur: 500 },
             right: { tag: 'note', pitch: 'd4', dur: 500 } } }
</code></pre>

<p>should print b4, c4, d4</p>

<p>Thanks</p>
