Emphasizing that all two are bad practices, follow the answers:
About Lock command to see Source Code
It is not possible to prevent the user from entering the code (view-source:) running on the machine. After all, the HTML they will receive will be readable in plain text. You can cause a nuisance for most people, but that won’t be a valid security measure - the chrome extensions will still run, for example, so if someone is using the Noscript extension, they will disable all javascript.
A much better option would be to handle your logic server, and just send the client the information they need to know / request.
There are some free javascript obfuscators, such as https://javascriptobfuscator.com/. Remember that it is not a safe method, however.
Ja Right click can be locked
As told by Edson
Thus:
document.oncontextmenu = document.body.oncontextmenu = function() {return false;}
You should make a safe application and not try to hide your code search on Gulp and Grunt besides the F12 tbm shows the code
– Costamilam
Don’t worry about it. With time and practice your code gets clean and organized to the point where you’re not afraid of other people seeing.
– Bacco