title: How to use onclick with a function expression rather than a declared function?
body: <p>I have a button</p>
  
  <pre><code>var startButton = $('#startButton').get(0);
  </code></pre>
  
  <p>that I attach the vanilla javascript onclick method to the button and call start on click.</p>
  
  <pre><code>startButton.onclick = start;
  </code></pre>
  
  <p>I want to use a function expression but (due to hoisting?) this doesn't call start</p>
  
  <pre><code>var start = function() {
    console.log('requesting local stream');
    startButton.disabled = true;
    getUserMedia(constraints, gotStreamSuccess, errorCallback);
  }
  </code></pre>
  
  <p>A declared function does</p>
  
  <pre><code>function start() {
    console.log('requesting local stream');
    startButton.disabled = true;
    getUserMedia(constraints, gotStreamSuccess, errorCallback);
  }
  </code></pre>
  
  <p>How can I write</p>
  
  <pre><code>startButton.onclick = start;
  </code></pre>
  
  <p>so that it works with a function expression?</p>
  
  <p>Thanks</p>