Since I never had close contact with javascript I would like to clarify some aspects:
Whenever I’m assigning new
instance of an object to a variable
does the previous object is deleted
as it happens in java (with help of
garbage collector)?
Can I declare a class as abstract
one and there are interfaces in
javascript? If the answer is yes
then give me a little example,
please. Just to see its syntax…
I am not 100% sure here, I haven’t really dived into the UnityScript engine as of yet, but in Javascript and Actionscript 3 (both of which are based off of the ECMA Script standard), objects which have no references to them (orphaned variabled) are removed (or queued for removal) by the garbage collector; so I assume that it is the same here with UnityScript.
As syclamoth stated, UnityScript is a unique version of Javascript (though it is closest to using the ECMA Script 4 standard – the same on that Actionscript 3.0 uses). You can create interfaces though, and it is pretty much exactly the same as in Java. Here is a quick interface example for UnityScript:
`
public interface MyInterface{
function GetMyName():String;
}`
To implement the interface you also do it like in Java: