{"author_url":"https://blog.hatena.ne.jp/takuya_1st/","version":"1.0","categories":[],"url":"https://takuya-1st.hatenablog.jp/entry/2014/05/12/170923","width":"100%","published":"2014-05-12 17:09:23","author_name":"takuya_1st","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftakuya-1st.hatenablog.jp%2Fentry%2F2014%2F05%2F12%2F170923\" title=\"Javascript\u306eiteration\u3092\u4f7f\u3063\u3066Flatten - \u305d\u308c\u30de\u30b0\u3067\uff01\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_title":"\u305d\u308c\u30de\u30b0\u3067\uff01","image_url":null,"title":"Javascript\u306eiteration\u3092\u4f7f\u3063\u3066Flatten","provider_name":"Hatena Blog","blog_url":"https://takuya-1st.hatenablog.jp/","height":"190","type":"rich","provider_url":"https://hatena.blog","description":"\u524d\u56de\u307e\u3068\u3081\u305f \u3001 iterator \u7cfb\u306e\u6a5f\u80fdmap/reduce/each\u7cfb\u3092\u4e0a\u624b\u306b\u4f7f\u3048\u3070\u3001flatten \u3082\u4f5c\u308c\u308b\u3002\u3053\u306e\u3078\u3093\u306fruby\u3068\u540c\u3058\u3067\u884c\u3051\u3066\u5b09\u3057\u3044\u306d\u3002 flatten\u3059\u308b\u306e\u3082\u697d\u3061\u3093\u3060\u3088\u3002 > [[1],[2],[3],[4]].reduce(function(v,e){ return v.concat(e) },[]) [ 1, 2, 3, 4 ] > Array#flatten \u4e0a\u8a18\u306e\u4f8b\u3060\u3068\u3001\u518d\u5e30\u51e6\u7406\u3057\u306a\u3044\u306e\u3067\u3001\u518d\u5e30\u51e6\u7406\u8ffd\u52a0\u3057\u3066OK Array.prototype.flatten = function() { var a = this.reduce( function(e,v){ \u2026"}