Operator '++' cannot be used with an expression of type 'Object'

I keep getting the error from this code called “Destroy”

static var counter;

function OnTriggerEnter (){
    Counter.counter++ ;

I think its mainly due to it not linking up with the other code using that static variable called “Counter” which this is the code for

static var counter;

 guiText.text = " " +counter;

static var counter;

How can your compiler know that this is an int? You have to define it as an int-

static var counter = 0;

or even better

static var counter : int = 0;

This is why I don’t like UnityScript. Consider C#, that’s the better option in my opinion.