title: Keeping the last value
body: <p>what do I have to change to this code, so that it doesn't take &quot;balls&quot; with the value of 10 every time? More precisely, &quot;balls&quot; to keep their last value. Thank you in advance!</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let balls = 10;
  let randomB = Math.floor(Math.random() * 10) + 1;
  if (randomB % 2 == 0) {
    balls++;
  } else {
    balls -= 2;
  }
  console.log(balls)</code></pre>
  </div>
  </div>
  </p>