Lap timer help (JS)

Hey guys, I’m trying to setup a lap time counter for a racing game I’m working on.
So far this is what I’ve managed to do.
However, while the seconds keep counting I’m not being able to make the minutes go up with this implementation and reset the seconds to 0 when they reach 60.

Help would be greatly appreciated.

var timer = 0.0;
private var mins = 0;
var lapTime: TextMesh;

function Update () {
	timer += Time.deltaTime;
	// Displays the current time on F2 format (with decimals)
    lapTime.text = mins + ":" + timer.ToString("f2");
    if(timer == 60.0){
    	timer = 0;
    	mins ++;
    }
}

The timer variable will never be exactly 60.0. Don’t use == with float comparisons, use <= or >=. Along those lines, you should use timer -= 60.0 instead of timer = 0, otherwise the time will be increasingly incorrect every minute.

Usually the timer never exactly 60.

use this:

if (timer >= 60.0){
    timer -= 60.0;
    mins ++;
}