Resetting Timer Using PlayerPrefs? (JS)

Hey, I’m working on a game that involves a timer, and once it gets to zero it resets. I want it so it will always go back to ten, and I want the time to be saved into PlayerPrefs so it when you start the game the timer is at the same number it left off at when the game was closed. Here is my script so far:

`#pragma strict
var timevalue : int;

function Start ()
{
Repeat ();
}

function Repeat ()
{
while(true)
{
yield WaitForSeconds (1);

timeval -= 1;

PlayerPrefs.SetInt(“time”, timeval);

PlayerPrefs.Save ();
}
}
function Update ()
{
if(timevalue < 1);
{
timevalue += 10;
}
}`

I’m working using javascript (as you can tell), so please make sure you reply with javascript answers.

I figuregd out how to do it without variables, here.

#pragma strict

function Start () 
{
	Repeat ();
}

function Repeat()  
{
	while (true)
	{
	    yield WaitForSeconds (1);
	    PlayerPrefs.SetInt("time", PlayerPrefs.GetInt("time") -1);
	    PlayerPrefs.Save ();
	}
}

function Update ()
{
	if(PlayerPrefs.GetInt("time") <1)
    {
	     PlayerPrefs.SetInt("time", 10);
	}
}

function OnGUI()
{
    GUI.Label(Rect(10,10,100,20), PlayerPrefs.GetInt("time").ToString() );
}