If anyone opens the console then he/she can see the source code and that’s a security issue.
Any visitor can view any frontend code. You can protect your code from prying eyes by putting it in backend files. See the article on Code Visibility for an explanation.
Thanks Yisrael.