Counterpoint: most Javascript on the web is obfuscated to all hell. While technically you can see the code that’s running, it being obfuscated is definitely not in the spirit of FOSS, and largely the open source components of servers are being used to prop up all the closed-source stuff reaching end users.
Counter counterpoint: Often frontend js code is minified so that it is smaller and more efficient to transfer to the browser. For FOSS projects you should still be able to get access to that code, unminified, from the project git repo. In the same way desktop apps often ship as binary executables but you can still see the code that was compiled to build them if you find the source repo.
It does make things harder to debug for an average user but it makes it faster/more efficient to run for most end users (in the case of the desktop or phone app it makes it possible to run without needing compiler toolchains that mom and pop likely wouldn’t be able to grasp).
The key thing isn’t that what the end user’s computer runs is readable and editable but whether the code used to build that artifact is available easily and what restrictions there are on editing and redistributing that code.
It’s not about Javascript. All of the frameworks and front end tools are open source. React, nextjs, tailwind etc. - all are foss projects and run the best UX and UI we know of.
I don’t really want to be that guy, but at least in the case of React and NextJS, the companies have a business reason for them being open source.
Meta uses React internally in a lot of projects. Every other company or developer making contributions in their spare time is free labor, and it directly improves Meta’s own products.
Vercel has a vested interest in having developers adopt NextJS, as they sell web hosting. It’s easier to build a community of developers around an open-source product, and they even help out with contributions, documentation writing, and QA.
My point is more that all these open source tools have been used by many, many, many sites to build a series of black boxes on top, for which there is no source available. I suppose one easy example is the existence of EME in open source browsers, the existence of which being the reason I actually don’t run a pre-compiled binary of Firefox, instead building it myself, with EME not built in.