When I make array object named "name", type automatically changes to "String", not "Array". Why?
<body>
<script>
console.log('---------------------------------');
var name1 = ['abc', 'def'];
console.log(name1);
console.log(typeof name1);
console.log('---------------------------------');
var name = ['ghi', 'jkl'];
console.log(name);
console.log(typeof name);
</script>
</body>
Result in Chrome(Mac):
---------------------------------
["abc", "def"]
object
---------------------------------
ghi,jkl
string // <- Why?
https://developer.mozilla.org/en-US/docs/Web/API/Window.name
It is a string, because window.name has a purpose. You are setting the name of the window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With