Error in code when converting (JS)

Hey there folks, i tried to make a C# script into a javascript, just to have all my scripts in the same language. but something went wrong. I’ve been starring at this code for a really long time now and can’t find the error.

I really need your skills now Unity community, thanks!

#pragma strict

var speed : float;
var position : Vector3;
var controller : CharacterController;

function Start ()
{
	position = transform.position;
}

function Update ()
{
	if (Input.GetMouseButton (1))
	{
		locatePosition ();
	}

	moveToPosition ();
}

function locatePosition ()
{
	RaycastHit hit;
	Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);

	if (Physics.Raycast (ray, out hit, 1000))
	{
		position = new Vector3(hit.point.x, hit.point.y, hit.point.z);
	}
}

function moveToPosition ()
{
	if(Vector3.Distance (transform.position, position) > 1)
	{
		Quaternion newRotation = Quaternion.LookRotation(position-transform.position, Vector3.forward);

		newRotation.x = 0f;
		newRotation.z = 0f;

		transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, Time.deltaTime * 10);
		controller.SimpleMove(transform.forward * speed);
	}
}

function locatePosition ()
{
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);

     if (Physics.Raycast(ray, hit, 1000f))
     {
          position = Vector3(hit.point.x, hit.point.y, hit.point.z);
     }
}

var newRotation : Quaternion = Quaternion.LookRotation(position-transform.position, Vector3.forward);

Don’t you need to use var in these places?

RaycastHit hit;
Ray ray
Quaternion newRotation

Also this new does not belong to JS:

position = new Vector3