8
If I create a global Javascript variable, it can be easily accessed from the console:
<script>
var minhaVariavel = 0;
<script>
But if I create it like this:
<script>
$(document).ready(function (){
var minhaVariavel = 0;
});
<sctip>
Is it possible to somehow access it or is it really safe?
I need a way to not let my variable be accessible to the console.
Related: When to use var in javascript?
– rray
Remember that code encapsulation is something that helps to write correct code. Encapsulation serves no purpose in security issues because the user can replace his code with another if he wants (after all, he is the owner of the computer)
– hugomg
related to the encapsulation concept: http://answall.com/a/85755/13561
– Pedro Sanção