Skip to content

Commit

Permalink
result3 の作成にmapとsliceを使用
Browse files Browse the repository at this point in the history
  • Loading branch information
jun68ykt committed Aug 9, 2019
1 parent 1e2379b commit b8749b0
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions main.js
Expand Up @@ -14,18 +14,9 @@ document.addEventListener('DOMContentLoaded', function() {
document.test.txt.value = reader.result.toLowerCase();
var result2=reader.result.toLowerCase().split("\n").filter(str => str);

var result3=[];
for (var i = 0; i <result2.length; i++) {
result3.push(result2[i].split(/\s+/));
}

for (var i = 0; i<result3.length; i++) {
if(result3[i].length>=6){
while (result3[i].length>=6){
result3[i].pop();
}
}
}
var result3 = result2.map(
line => line.split(/\s+/).slice(0, 5)
);

Array.prototype.divide = function(n){
var ary = this;
Expand Down

0 comments on commit b8749b0

Please sign in to comment.