How do you know what a component is called in script?

I was following a tutorial in which one example has the following very simple code attached to a sphere:

function Update ()
renderer.enabled = true;

While I understand how it works, I don’t know how I would have known to access the sphere’s Mesh Renderer through “renderer.” When you click the documentation item next to the Mesh Renderer component, the documentation doesn’t specify that. My kneejerk reaction would have been to assume the component was called meshrenderer. For that matter, how would one know the enabled property is “enabled”? It’s not an unintuitive choice, I’m just curious how one actually finds these things out besides trial and error.

Is there a repository that has this information? Where would I find out about the script names for any arbitrary component and its properties?

Are you familiar with inheritance? Like the documentation of MeshRenderer shows at the top the MeshRenderer-class is derived from Renderer. The shortcut-property .renderer just returns the first Component of type Renderer if there is one. It’s the same as using GetComponent.() in UnityScript or GetComponent() in C#.

The inheritance chain is even a bit longer.

MeshRenderer inherits from Renderer
Renderer inherits from Component
Component inherits from Object

So every MeshRenderer is also a Renderer, a Component and an Object. Every Renderer is also a Component and an Object but not necessarily a MeshRenderer.

The point is that the Renderer class provides basic functions and properties that are needed / used by all types of renderers. You don’t have to know if it’s a MeshRenderer, ClothRenderer or SkinnedMeshRenderer to enable / disable it or set its material. It’s enough to know it’s a Renderer.