You're just describing leetcode here. Not something most people even do in their day-to-day.
A lot of frontend devs don't even work with the DOM directly after having spent years with React. Could they do it? probably. Are they prepared for DOM-related manipulation questions on a whiteboard? nope.
What exactly is leetcode? as opposed to just asking someone to prove they know the stuff listed on their resume.
And suppose there are a lot of cheaters out there who don't know the things on their resume, even including earning a degree without ever having to write a working program on their own. How would you screen them out?
A lot of frontend devs don't even work with the DOM directly after having spent years with React. Could they do it? probably. Are they prepared for DOM-related manipulation questions on a whiteboard? nope.