Jump to content
xisto Community
it01y2

Destroying Variables In Javascript Destroying variables in javascript

Recommended Posts

This is how I would do it. There might be a proper function that does it but this method works perfectly well.

<script type="text/javascript">// Set variablecolour = "blue";// Delete its contentscolour ="";</script>

Share this post


Link to post
Share on other sites

ok I have javascript in a loop and the variables for each loop is clashing.egfirst loopvar countdown = "2"first loopsecond loopvar countdown = "5"second loopIs there any way in javascript to do thisx=0first loopx++varcountown x = 1first loopsecond loopx++varcountown x = 5second loopthe x results the variable name to be listedvarcountown1varcountown2varcountown3varcountown4varcountown5so they dont clash is this possible? electriic ink?

Share this post


Link to post
Share on other sites

I dont really understand what are you trying to do but its possible that you give each variable a different name so that they dont clash and product different values for different var..

Share this post


Link to post
Share on other sites

Perhaps you could describe what you are trying to do so we can understand the logic you are trying to get behind by using 2 loops. I don't really understand why you are using 2 loops to do a countdown.

Share this post


Link to post
Share on other sites

If it is in a PHP loop you can still change the name of the Variables.I did not get the reason why cant you have different names for the variables.Also if you dont want them to clash put / insert them in a array and then check if the value exists or not in the array.If it does then do something and change the value that will now be inserted.If it does not then insert it making things unique.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.