Useful or not, it can already be done clearly and concisely:
```jslet a = [1,2];
let b = a.map(x => `I have ${x} apples now`);
// If using a lot of these, try a tagged template literal:
function shabazz(strings, a) {return a.map(x => strings.join(x))}
let c = shabazz`I have ${a} apples now`;
let d = shabazz`(${a} + ${a})/${a}`;
```
On Friday, May 11, 2018, 12:59:14 PM CDT, Abdul Shabazz
<[email protected]> wrote:
Similar to Matlabs operations on sets
Example 1:
let a=[1,2,...];let b="I have ${a} apples now"; // b=["I have 1 apples now ",
"I have 2 apples now",...]
Example 2:
let b="(${a} + ${a}) / ${a}"; // b=["(1 + 1)/1", "(2 + 2)/2",...]
...and why this is useful, I have no idea.--
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