Elegant way to generate string from tagged template?

Gary Guo nbdd0121 at hotmail.com
Tue Dec 23 04:21:33 PST 2014


> From: curvedmark at gmail.com
> Date: Tue, 23 Dec 2014 14:55:57 +0800
>
> Given an array of [1,2,3] and other array of [“a”,”b”], it should return [1,”a”,2,“b”,3]. (probably a lot of edge cases to cover, but just ignore them for now).

It is not a hard task. I don't think we need to add it into the spec.
If you really want, use this:

```js
Array.blend=(a,b)=>{
    let ret="";
    for(let i=0;ret+=a[i],i<b.length;ret+=b[i],i++);
    return ret;
};
``` 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141223/5cd1f156/attachment.html>


More information about the es-discuss mailing list