Here's why:
* Adverb: When "barely" modifies a verb, adjective, or another adverb, it describes the extent or degree of something.
* Example: "I barely finished my homework." (Describes the extent of finishing the homework)
* Adjective: "Barely" can function as an adjective when it describes a quantity or amount. It usually implies a lack of something.
* Example: "There was barely any food left." (Describes the quantity of food)
In most cases, "barely" is used as an adverb.