What is getAttribute used for?

What is getAttribute used for?

With the getAttribute() method, you can get the attribute value of the specific element. When the attribute would exist, the string value would be returned which would represent the corresponding attribute value. When it ceases to exist, a null or an empty string would be returned.