This question already has answers here:
Closed 4 years ago.
<div id="par">
<span id="a1"></span>
<span id="a2"></span>
<div id="par2">
<span id="a3"></span>
<span id="a4"></span>
</div>
</div>
<script>
var ele = document.querySelectorAll('#par span');
for( var p of ele ){
console.log(p);
}
</script>
When i run this code I see error
Uncaught TypeError: ele[Symbol.iterator] is not a function
How to fix this problem ?