Not Able to Get Index of Element in Array in JavaScript : <p>Can you please take a look at this code and let me know why I am not getting the index of each array element which is not 0 in this loop properly?</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 st = "0,1,0,0,1,1";
let arr = [];
arr = st.split(',');

for(var i = 0; i &lt; arr.length; i++){
  if( arr[i] != 0){
   console.log(arr.indexOf(i))
 }
}</code></pre>
</div>
</div>
</p>
