How to make speed changed in js

i know, this is very simple. First off, this is not going to be attached to my Enemy but i want to know if its possible to change the navmeshspeed from a script to my enemy. It is named “OGRE”. I need this script converted into Javascript, and i need it to somehow do it remotely without attach the script to the enemy.

Need this converted and remotely change speed:

    GetComponent<NavMeshAgent>().speed = 6f;

Yes, I don’t know if its possible. Yes my “Enemy” is named “OGRE”. it would be very awesome if you could respond fast. Thanks!

Full script:

#pragma strict

var coinValue = 1;

function OnTriggerEnter(info: Collider)
{
	if (info.name == "Player")
	{
		GameMaster.currentScore += coinValue;
		Destroy(gameObject);
		GetComponent<NavMeshAgent>().speed = 6f;  // <---- Need this converted remotely!
	}
}

In your script attached to the desired object, declare a public NavMeshAgent

var agentToControl : NavMeshAgent;

In the Unity Editor, drag & drop the gameobject holding the NavMeshAgent component that must be controlled by your 1st script.

Then, you just have to change the value as you want.

function ChangeAgentSpeed()
{
    agentToControl.speed = 6f ;
}