0

I'm new in coding and actually learning Javascript.

I'd like to iterate throught alphabet and dynamically set variables and contents in Javascript. The result should be :

var botA = eleve["bot-A-value"];
var botB = eleve["bot-B-value"];
var botC = eleve["bot-C-value"];

How would you do that please ? Thanks for your help and sorry if this topic may have already been resolved

Barmar
  • 741,623
  • 53
  • 500
  • 612
Sinocal
  • 11
  • 3
  • 1
    _"How would you do that please ?"_ - not at all. You should use an _array_ or _object_ for something like this, not individual variable names. – CBroe Feb 22 '22 at 11:17
  • 1
    Which `eleve` already is. – Quentin Feb 22 '22 at 11:19
  • Thanks guys for your answers. I've made an array with alphabet and I iterated on it but can't instanciate variables with type before the the variable. "var" seems blocked or something, I can't use it in my for loop. – Sinocal Feb 22 '22 at 13:30

0 Answers0