GetComponent<T>() asks Unity for a component of type T on the same GameObject as the script. It is commonly used to cache references such as Rigidbody2D, Animator or AudioSource in Awake or Start. (course lab series, see source-csharp-unity-labs)
If the component is missing, GetComponent returns null. Beginner scripts should check the result and log a clear error before trying to use it.
Related: unity-getcomponent, component, nullreferenceexception, getcomponent-vs-inspector-references