Skip to content

Commit 603db35

Browse files
committed
Array Methods are great added Problem 2 and working on problem 3
1 parent c35d0e8 commit 603db35

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

assignments/array-methods.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,22 @@ console.log(`ticket Price Total: $ ${ticketPriceTotal}`);
130130
\n 3XL = ${printing3XShirts.length}`);
131131
// Problem 2
132132

133-
// Problem 3
133+
134+
135+
// create a new array of object with unique sizes to be printed
136+
137+
138+
var printSizes = [];
139+
runners.filter(function(item){
140+
var i = printSizes.findIndex(x => x.shirt_size == item.shirt_size);
141+
if(i <= -1){
142+
printSizes.push({shirt_size: item.shirt_size});
143+
}
144+
return null;
145+
});
146+
console.log(printSizes);
147+
148+
// Problem 3
149+
150+
// here we will combine the problem 1 & problem 2 to produce an elegant programmatic solution to
151+
// help the race director order the appropriate tShirts in an exact quantity

0 commit comments

Comments
 (0)