title: Update variable when value is present
body: <p>I have a simple string of code. I want to show a default value when the page is loaded where the function <code>numResults()</code> is. At some point I want to update <code>numResults()</code> with a new value and then change the string without reloading the page.</p>
  
  <pre><code>$('#step1').before('Showing results 1 - ' + numResults());
  
  function numResults(value) {
      var results = 10; // default number
  
      if (value) {
          return value; // show updated value
      } else {
          return results; // show default
      }
  }
  </code></pre>