Change guiText to TextMesh?

Hey guys

I have this code:
guiText.text = transform.parent.guiText.text;

That basically change the gui text to the parent text.

Anyone knows how can i change in the code from guiText to TextMesh?

Thanks!

C#

GetComponent<TextMesh>().text = transform.parent.GetComponent<TextMesh>().text;

Javascript:

GetComponent(TextMesh).text = transform.parent.GetComponent(TextMesh).text;

If you are going to be doing this every frame, it might pay to save the reference acquired by GetComponent() rather than call GetComponent() twice every frame.