newish JavaScript syntax
Mar. 20th, 2018 10:26 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Some stuff for me to learn.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Object_literals
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
My initial reaction to some of those examples is stunned disbelief. Why would you want to allow defining a property whose name is an empty string, an exclamation mark, or a number? And why would you use array syntax, [], for those, when they aren't arrays? So that "car[7]" is not necessarily the 7th item in a car array, but might be a car property by the name of 7?
Yeah. How fun.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Object_literals
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
My initial reaction to some of those examples is stunned disbelief. Why would you want to allow defining a property whose name is an empty string, an exclamation mark, or a number? And why would you use array syntax, [], for those, when they aren't arrays? So that "car[7]" is not necessarily the 7th item in a car array, but might be a car property by the name of 7?
Yeah. How fun.