Note: using this method, we can only check the existence of an attribute! But if you want to set a new attribute for an element, you can use the `setAttribute()` method instead. Also, if you want to get the value of an attribute, you can use the getAttribute() method.
Element hasAttribute() Method Syntax:
Element hasAttribute() Method Parameter
The method takes one argument and that is the name of the attribute we want to check its existence in the target element.
Element hasAttribute() Method Return Value
The return value of this method is of type boolean.
The value true means the target element has this attribute already.
The value false means otherwise.