ESLint says array never modified even though elements are pushed into array : <p>I am converting some existing code to follow ECMA script and I am using ESLint to follow a coding standard.  I have the following ecmascript method</p>

<pre><code>static getArrayOfIndices(text, char) {
    let resultArray = [];
    let index = text.indexOf(char);
    const lastIndex = text.lastIndexOf(char);
    while (index &lt;= lastIndex &amp;&amp; index !== -1) {
      resultArray.push(index);
      if (index &lt; lastIndex) {
        index = text.substr(index + 1).indexOf(char) + index + 1;
      } else {
        index = lastIndex + 1999; // some random addition to fail test condition on next iteration
      }
    }
    return resultArray;
  }
</code></pre>

<p>For the declaration of resultArray, ESLint throws the error </p>

<pre><code>ESLint: `resultArray` is never modified, use `const`instead. (prefer-const)
</code></pre>

<p>But since elements are being pushed into the array, isn't it being modified? </p>
