title: variable is not reassigned when changed in for loop js
body: <p>when trying to change the variable value its not changing although it is <strong>global</strong>:</p>
  <pre><code>            let avg = 0
              let total = 0
              let courseNum = prompt(&quot;Enter the number of courses you have taken: &quot;);
              let CourseInt = parseInt(courseNum);
              for (let index = 1; index &lt;= CourseInt; index++) {
                  const courses = prompt(&quot;Enter the grade for course #&quot; + index + ':');
                  for (let i = 0; i &lt; courses.length; i++) {
                      if (parseInt(courses[i]) &gt; 50) {
                          total =+ courses[i];
                      }
                      avg = total / courses.length;
                  } 
              }
              prompt(&quot;YOUR AVG: &quot; + avg)
          &lt;/script&gt;
  </code></pre>
  <p>in the prompt popup it shows that the avg is <strong>0</strong>.</p>