0

Say I have these variables

var word1 ='wordA';
var word2 ='wordB';
var word3 ='wordC';
var word4 ='wordD';
var word5 ='wordE';

and I have this loop

for (var i=1; i<6; i++) {
    // make word + i = ''; (an empty string)
}

how would I go about doing so using Actionscript 2?

1 Answer 1

2

Try this:

for (var i=1; i<6; i++) {
    this[ "word" + i ] = ''; (an empty string)
}
Sign up to request clarification or add additional context in comments.

1 Comment

Ah, it works. I normally code in Javascript and use $(this) when using Javascript selectors, I find it strange that 'this' in actionscript can be used this way. Interesting.. anyways, thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.