The benefits are so easily taken for granted as just being normal parts of life.
Just like how we take for granted that you can count on your food label not lying to you and your food not having dangerous ingredients, with proper inspections and such.
That's an ironic example, because I've been to several areas where Coke is the generic term and people would be confused if you said soda or soft drink or whatever. I have literally asked for a Coke and been asked "what kind?", with a gesture to a menu listing Sprite etc. (They were not asking about Diet Coca Cola.)
But it stops you from getting an equivalent coke from any other vendor, even if you might want to (because it might be cheaper). You're assuming that everyone finds it as important as you do that your “Coke” comes from a specific manufacturer regardless of what the product actually is or contains.
For Coke you might be right about most people (though not me) but there are plenty of products where brand loyalty isn't a thing. People just want some decent hand tissues around, nobody cares if it's made by actual Kleenex.
You're probably thinking of Genericisation. This isn't a law in the sense you probably mean, there is no statute about it, no legislature wrote it, nobody signed anything. Instead Genericisation is a legal doctrine related to the core idea in trademark law that we can't have exclusive use of descriptive marks.
Suppose you make a Big Car and you try to trademark "Big Car" as your exclusive mark for this new product. That's just describing the car, it's generic so you can't do that, it's OK to trademark "Giganticar" or "Waterluvian Car" or something because people can describe what their similar product is with the words "big car" but if you were allowed to own "Big Car" they can't do that.
Genericisation says well, if your product is so successful that now everybody knows what a "Waterluvian" is, and most people shown a new big car from say, Ford, say "Waterluvian" so that even Ford's sales people struggle to teach the guys on the forecourt not to call this a "Waterluvian" - that's now a generic term, you can't stop Ford just saying they're making a Waterluvian.
Genericisation only applies for crazy famous stuff. Kleenex is an example because your mom knows what a kleenex is, the guy who mows your lawn knows, Elon Musk knows, everybody knows, that's actually famous. Javascript probably wouldn't meet that requirement. My mother does not know what Javascript is, my boss does, because he's a software engineer, and maybe the average numerate graduate knows, but I wouldn't bet a lot of money on it.
Dilution is a related idea, also for very famous things. Dilution says for these famous things it's not OK to use the famous mark for any other purpose even though it's not related. So Disney toilet paper isn't OK, Coca-Cola brand vibrators, not OK, and so on. Nobody thinks the vibrator is a beverage, but Coke is so famous that doesn't matter. That doesn't impact here either.
Is there a relative component to the evaluation of genericisation? eg., if only truck drivers know about the term Waterluvian, but the vast majority use it in the generic way, then it's generic? Because it would be a relevant update to that law, & apply here
Because there's not actual written legislation, you could try to make this argument in court, but, previously courts have stuck to the idea that they mean everybody so truck drivers wouldn't be enough. Maybe "Everybody in New York" cuts it in a New York court, certainly I'd expect that "Nigerians don't know this word" wouldn't count against you in any court in the United States of America - but the sort of relativity you're thinking of was definitely not on their mind.
The amount of people that use JavaScript to refer to the Oracle-provided JavaScript is zero, the amount of people who can refer to the Oracle-provided JavaScript over the last 10+ years is zero. Because it isn't a thing. I'm pretty sure that is against trade mark regulations.