I don't understand; a = a.map(...) works fine--not something I would write, I
tend to use single assignment style.
Perhaps I misunderstood, because both of your examples produced strings, and
you used the same ${} notation as template literals. Now,I think you want is
some sort of syntactic sugar that does "a.map(x => <expression>)", but
eliminates the need to type "map" and the arrow function. That is:
```js
let a = [1, 2, 3];
let b = ${a} * 2; // de-sugars to a.map(x => x * 2)
// b is now [2, 4, 6]
let objs = [{foo: "bar"}, {foo: "baz"}];let foos = ${objs}.foo; // de-sugars to
objs.map(x => x.foo)
// foos is now ["bar", "baz"]
```
Is that correct?
On Saturday, May 12, 2018, 12:34:00 AM CDT, Abdul Shabazz
<[email protected]> wrote:
I'm familiar with Array.prototyp.map functionality and I've ran into problems
with it when attempting double assignments (eg. a=a.map(...)) or when omitting
the RETURN keyword (eg . a.map((x)=>{1}) != a.map((x)=>{return 1})
I feel it needs cleaning up a bit, which is why I made such suggestion.--
Abdul S._______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss