- Регистрация
- 28.10.2011
- Сообщения
- 44
- Благодарностей
- 0
- Баллы
- 0
Hi, I am trying to take the random out put of an array, then use that variable to change it into something else? I have the original array in JS, but can't think of how to do this second part?
EX. [John, Jim, Ed].. now I pull a random name "John". I use this name in my template, but near the end of the template I want to change this name to the number 1. (All John's to #1, all Jim's to #2, all Ed's to #3).
The problem is I have about one hundred names, so can't just use a simple if statement to do it 3 times.
EX. [John, Jim, Ed].. now I pull a random name "John". I use this name in my template, but near the end of the template I want to change this name to the number 1. (All John's to #1, all Jim's to #2, all Ed's to #3).
The problem is I have about one hundred names, so can't just use a simple if statement to do it 3 times.