Can anyone explain to me what is the problem with the word 'name' in JavaScript? see this code:
The result of the first code will say that the variable name is an object and that name is a string, and the difference (apparently) of the variables is just the naming.
<script>
var name = ["Henrique"];
var nome = ["Henrique"];
document.write("Tipo da variável nome " + typeof(nome));
document.write('</br>');
document.write("Tipo da variável name " + typeof(name));
</script>
When I put the code inside an IIFE, the result will be the object for both.
<script>
(function(){
var name = ["Henrique"];
var nome = ["Henrique"];
document.write("Tipo da variável nome " + typeof(nome));
document.write('</br>');
document.write("Tipo da variável name " + typeof(name));
}());
</script>