When running the for loop, everything appears to be working smoothly except for the failure to update the element variable as planned.
<h6>Q1</h6>
<h6>Q2</h6>
<h6>Q3</h6>
However, the output I actually received was:
<h6>Q1</h6>
<h6>Q1</h6>
<h6>Q1</h6>
function results() {
var listResults = '';
var i = 0;
const element = `
<h6>Q${i + 1}</h6>
`;
for (x = 0; x < 3; x++) {
listResults += element;
i++;
}
return listResults;
}
console.log(results())