Append an integer to a string name
===

Hi Im trying to iterate through a for loop from along string of words held in a single string(wordlist), within impactjs:


var wordlist ="hellwhentrysthisbreaks"

        var  xc=3;
        var word_length = 4;
	var words_in_round = 4;
		
             
        for ( i=0; i<words_in_round; i++){
        
            var num_words = ['wordlist' + xc].length / word_length;
            var random = Math.floor(Math.random() * ((num_words+1) - 0 ));
            n = Math.round(random / word_length) * word_length;
           random_word =(['wordlist' + xc].substring(n,(n+word_length)))
           random_words += random_word;
           }

The above code works if i define wordlist as a global, but when i made it local num_words is not defined properly and random word throws this object has no method substring ..

any help apprecated
