Check out example codes for "Add component object to gameobject unity". It will help you in understanding the concepts better.

Code Example 1

//to add a new ridgidbody
gameobject.AddComponent<Rigidbody>();
//to add a new meshCollider
gameobject.AddComponent<MeshCollider>();
//Original answer by MakerBenjammin6, cleanup by me.

Code Example 2

void Reset()
{
  //Your code here
}

Code Example 3

//This uses C# and unity
//to add a ridgidbody
gameobject.addComponet<ridgidbody>();
//to add a meshCollider
gameobject.addComponet<MeshCollider>();
//check out my profile

Learn ReactJs, React Native from akashmittal.com