how do you delete variables or arrays?

How do you delete or destroy variables or arrays in unity javascript?

Is there a delete?
I tried using Destroy but it only works with objects and components.
Do I just rewrite or declare the variable again?

If I’m wrong, please someone correct me.

In .net a variable exist only as long as it is referenced somewhere, unlike languages like C++ where you have to delete pointers and co. So if you’re concern with memory leaks, just make sure to affect null to variables you don’t need anymore.

By the way, C# does allow you to manually define blocks of code that should be garbage-collected immediately after use with the “using” statement. (Not to be confused with the using directive for namespaces that you always see at the beginning of a file!).

If you are Using a javascript array

for (var i:int = 0;i < array.length;i++){

if you are using a build in array of number you just need to set them to null
for (var i:int = 0;i < array.length;i++){
array = null;
and i don’t think you can destroy variables, just change their values.