why this does not work?? I think it is logically correct.
P.S: I am new to JavaScript.
JavaScript part:
var i;
for(i=1; i=3; i++)
{
var bbb[i] = document.querySelector('.txtt[i]');
console.log(bbb[i].value);
}
Html Part:
<input type="text" id="txtt1" class="txtt1" value="">
<input type="text" id="txtt2" class="txtt2" value="">
<input type="text" id="txtt3" class="txtt3" value="">
expectation: bbb[i] should contains the value of the particular input element as every time loops run a new variable should be created.
Actual: console shows error
SyntaxError: unexpected token: '['
var bbb = []and then in the loopbbb.push(document.querySelector...). Also note that variables are not automatically interpolated into strings like '.txtt[i]'...