title: What limit value I need set to stop my function?
body: <p>I'm trying to create a progress bar with a percentage text using only Javascript, but I don't know what value I need set in the function to limit the incrementation. The bar and the text keep increasing.
  Need create 4 skills bar with 30% / 50% / 70% and 90%. </p>
  
  <p>Help, plz! Accept any suggestions!
  Here is my code. </p>
  
  <pre><code>    &lt;div class="progress"&gt;
          &lt;div class="progress-bar"&gt;&lt;/div&gt;
          &lt;p value="30" class="text"&gt;30&lt;/p&gt;
      &lt;/div&gt;
  
    &lt;script&gt;
      function update() { 
        let element = document.querySelector(".progress-bar");    
        let counter = document.querySelector(".text");
        var width = 1; 
        var identity = setInterval(scene, 10); 
        function scene() { 
          if (width &gt;= counter.value) { 
            clearInterval(identity); 
          } else { 
            width++;  
            element.style.width = width + '%';  
            counter.innerHTML = width * 1  + '%'; 
          } 
        } 
      } 
  &lt;/script&gt;
  </code></pre>