Literally, it can not prevent users from accessing and modifying the content that is being sent to them. It has no control over the browser, or what browser they use, or if in fact they are downloading their source code through a browser. You are running your code on someone else's device. You should not and can not assume anything about the integrity of this device.
If you have a code that you do not want to be exposed, do not send it to the browser. Instead, allow the browser to send a request to a server where it executes the secret code.
As a concrete example, do not verify passwords on the client. The client could be modified to always indicate to the server "the password was correct". Instead, authentication must occur on your trusted server.