Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b7b937 commit 91a5be7Copy full SHA for 91a5be7
assets/array-methods-exercises.js
@@ -0,0 +1,22 @@
1
+const flowers = [
2
+ { name: 'tulip', color: 'red' },
3
+ { name: 'dandelion', color: 'yellow' },
4
+ { name: 'rose', color: 'red' },
5
+ { name: 'daisy', color: 'white' },
6
+ { name: 'lily', color: 'white' },
7
+];
8
+
9
+// Exercise 1
10
+// use `map` to make the first letter of al flowers a capital.
11
+// so 'tulip' becomes 'Tulip' etc.
12
13
+// Exercise 2
14
+// use `filter` to get only the flowers with a name of 4 characters
15
16
+// Exercise 3
17
+// use `reduce` to create an object that contains
18
+// the total number of flowers for each color
19
20
+// Exercise 4 (bonus)
21
+// use `some` or `every` in combination with another array method
22
+// to find out if all flowers with five letters are red
0 commit comments