2 ms·
>> Why have [] syntax for "arrays" [] syntax is for objects and arrays. As I've said, an array is just an object... Same data type. If you didn't have a [] sy
by axod 17y ago
>> Why have [] syntax for "arrays"
[] syntax is for objects and arrays. As I've said, an array is just an object... Same data type.
If you didn't have a [] syntax, you wouldn't be able to use a variable to reference properties on an object.
var baz = "foo";
foo.bar == foo["bar"] == foo[baz]