Why do i get 4 errors here? (Javascript)

Why do i get 4 errors in this? I even have the component with the errors in other scripts, that has no errors :frowning:

var Sound : AudioClip;
var startTime;
var timer1:int;


function Update () {
function Update (){TimerStart();}

	if(Input.GetKeyUp("f")) {
		audio.clip = Sound;
		audio.Play();
		function TimerStart (){

			startTime = Time.time;
			
			timer1 = Time.time; 
			
			if(timer1 > 1){
			audio.clip = Sound; 
			audio.Stop();
			
			}
		}
	}
}

You should not declare functions inside functions, and startTime should be typed to avoid possible errors. I don’t have the slightest idea of what you’re expecting this code to do, but it could be written like this:

var Sound : AudioClip;
var startTime: float; // declare the variable type
var timer1: int;

function Update (){
  if(Input.GetKeyUp("f")) {
    audio.clip = Sound;
    audio.Play();
  }
}

function TimerStart (){
  startTime = Time.time;
  timer1 = Time.time; 
  if (timer1 > 1){
    // why do you set the audio.clip if you're going to stop it?
    audio.clip = Sound; 
    audio.Stop();
  }
}