How do you select an object with the cursor and retrieve data from that object selected?

I am using Javascript. Any help would be greatly appreciated. I know using rays has something to do with it, but I am a upper echelon noob.

You need raycasts, take a look at this: Unity - Scripting API: Physics.Raycast