Non expected variable outcome?

I am running into an issue where I set the variable lastDistance But the value is then set to 0;

		var curDistance=Vector3.Distance(destination,this.transform.position);
		if(curDistance>lastDistance){
			//Other code

		}else{
			lastDistance=curDistance; 
			Debug.Log(curDistance)); //returns 0.996
			Debug.Log(lastDistance); //returns 0
		}

Even though I JUST set lastDistance = to curDistance it has a different result. I assume I am missing something basic and fundamental, but I just can’t figure it out. I have also tried setting lastDistance = to the Vector3.Distance function, with the same result

Is lastDistance an integer? When assigning a floating point number to an integer everything after the decimal place gets cut off.

Thank you, I am use to web based JS, did not know you have to type cast in unity JS

Unity’s JS is unfortunately and confusingly nothing to do with what everyone else calls JS.