全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。
- コードを嗜む
- コードを学ぶ
- 武器を手に入れる
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| </head> | |
| <body> | |
| <textarea id="input" cols="40"> | |
| %25E3%2581%25AB%25E3%2581%258F%25E3%25 | |
| </textarea><br/> | |
| <input type=button value="decodeURI" | |
| onclick="decURI('input')" /> |
| Array.prototype.selectMany = function (fn) { | |
| return this.map(fn).reduce(function (x, y) { return x.concat(y); }, []); | |
| }; | |
| // usage | |
| console.log([[1,2,3], [4,5,6]].selectMany(function (x) { return x; })); //[1,2,3,4,5,6] | |
| console.log([{ a: [1,2,3] }, { a: [4,5,6] }].selectMany(function (x) { return x.a; })); |