gregoriorojas commited on
Commit
e9a47e1
1 Parent(s): 5526d70

Upload ignore-js-map-filterin.json

Browse files
Files changed (1) hide show
  1. ignore-js-map-filterin.json +202 -0
ignore-js-map-filterin.json ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "instruction": "Use map function to double each element in an array.",
4
+ "input": "[1, 2, 3, 4]",
5
+ "output": "const result = [1, 2, 3, 4].map(x => x * 2);"
6
+ },
7
+ {
8
+ "instruction": "Use filter function to get only even numbers from an array.",
9
+ "input": "[1, 2, 3, 4, 5, 6]",
10
+ "output": "const result = [1, 2, 3, 4, 5, 6].filter(x => x % 2 === 0);"
11
+ },
12
+ {
13
+ "instruction": "Use map function to square each element in an array.",
14
+ "input": "[1, 2, 3, 4]",
15
+ "output": "const result = [1, 2, 3, 4].map(x => x * x);"
16
+ },
17
+ {
18
+ "instruction": "Use filter function to get only numbers greater than 3 from an array.",
19
+ "input": "[1, 2, 3, 4, 5]",
20
+ "output": "const result = [1, 2, 3, 4, 5].filter(x => x > 3);"
21
+ },
22
+ {
23
+ "instruction": "Use map function to convert each element in an array to a string.",
24
+ "input": "[1, 2, 3, 4]",
25
+ "output": "const result = [1, 2, 3, 4].map(x => x.toString());"
26
+ },
27
+ {
28
+ "instruction": "Use filter function to get only numbers less than 5 from an array.",
29
+ "input": "[3, 5, 8, 1, 4]",
30
+ "output": "const result = [3, 5, 8, 1, 4].filter(x => x < 5);"
31
+ },
32
+ {
33
+ "instruction": "Use map function to add 10 to each element in an array.",
34
+ "input": "[5, 10, 15]",
35
+ "output": "const result = [5, 10, 15].map(x => x + 10);"
36
+ },
37
+ {
38
+ "instruction": "Use filter function to get only odd numbers from an array.",
39
+ "input": "[2, 3, 4, 5, 6]",
40
+ "output": "const result = [2, 3, 4, 5, 6].filter(x => x % 2 !== 0);"
41
+ },
42
+ {
43
+ "instruction": "Use map function to negate each element in an array.",
44
+ "input": "[-1, 2, -3, 4]",
45
+ "output": "const result = [-1, 2, -3, 4].map(x => -x);"
46
+ },
47
+ {
48
+ "instruction": "Use filter function to get only positive numbers from an array.",
49
+ "input": "[-3, -2, 0, 2, 4]",
50
+ "output": "const result = [-3, -2, 0, 2, 4].filter(x => x > 0);"
51
+ },
52
+ {
53
+ "instruction": "Use map function to get the length of each string in an array.",
54
+ "input": "[\"apple\", \"banana\", \"cherry\"]",
55
+ "output": "const result = [\"apple\", \"banana\", \"cherry\"].map(x => x.length);"
56
+ },
57
+ {
58
+ "instruction": "Use filter function to get only strings longer than 4 characters from an array.",
59
+ "input": "[\"apple\", \"cat\", \"banana\"]",
60
+ "output": "const result = [\"apple\", \"cat\", \"banana\"].filter(x => x.length > 4);"
61
+ },
62
+ {
63
+ "instruction": "Use map function to convert each string in an array to uppercase.",
64
+ "input": "[\"apple\", \"banana\", \"cherry\"]",
65
+ "output": "const result = [\"apple\", \"banana\", \"cherry\"].map(x => x.toUpperCase());"
66
+ },
67
+ {
68
+ "instruction": "Use filter function to get only strings containing the letter 'a' from an array.",
69
+ "input": "[\"apple\", \"dog\", \"banana\", \"cherry\"]",
70
+ "output": "const result = [\"apple\", \"dog\", \"banana\", \"cherry\"].filter(x => x.includes('a'));"
71
+ },
72
+ {
73
+ "instruction": "Use map function to multiply each element in an array by 3.",
74
+ "input": "[1, 2, 3, 4]",
75
+ "output": "const result = [1, 2, 3, 4].map(x => x * 3);"
76
+ },
77
+ {
78
+ "instruction": "Use filter function to get only numbers divisible by 2 from an array.",
79
+ "input": "[1, 2, 3, 4, 5, 6]",
80
+ "output": "const result = [1, 2, 3, 4, 5, 6].filter(x => x % 2 === 0);"
81
+ },
82
+ {
83
+ "instruction": "Use map function to subtract 1 from each element in an array.",
84
+ "input": "[1, 2, 3, 4]",
85
+ "output": "const result = [1, 2, 3, 4].map(x => x - 1);"
86
+ },
87
+ {
88
+ "instruction": "Use filter function to get only non-negative numbers from an array.",
89
+ "input": "[-1, 0, 1, 2, -2]",
90
+ "output": "const result = [-1, 0, 1, 2, -2].filter(x => x >= 0);"
91
+ },
92
+ {
93
+ "instruction": "Use map function to append '!' to each string in an array.",
94
+ "input": "[\"hello\", \"world\"]",
95
+ "output": "const result = [\"hello\", \"world\"].map(x => x + '!');"
96
+ },
97
+ {
98
+ "instruction": "Use filter function to get only strings that start with the letter 'b' from an array.",
99
+ "input": "[\"apple\", \"banana\", \"cherry\", \"blueberry\"]",
100
+ "output": "const result = [\"apple\", \"banana\", \"cherry\", \"blueberry\"].filter(x => x.startsWith('b'));"
101
+ },
102
+ {
103
+ "instruction": "Use map function to get the names of all persons in an array of person objects.",
104
+ "input": "[{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}]",
105
+ "output": "const result = [{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}].map(person => person.name);"
106
+ },
107
+ {
108
+ "instruction": "Use filter function to get all persons older than 25 in an array of person objects.",
109
+ "input": "[{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}]",
110
+ "output": "const result = [{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}].filter(person => person.age > 25);"
111
+ },
112
+ {
113
+ "instruction": "Use map function to get the names of all cars in an array of car objects.",
114
+ "input": "[{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}]",
115
+ "output": "const result = [{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}].map(car => car.make + ' ' + car.model);"
116
+ },
117
+ {
118
+ "instruction": "Use filter function to get all cars of a specific make in an array of car objects.",
119
+ "input": "[{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}]",
120
+ "output": "const result = [{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}].filter(car => car.make === 'Toyota');"
121
+ },
122
+ {
123
+ "instruction": "Use map function to get the names of all cities in an array of city objects.",
124
+ "input": "[{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}]",
125
+ "output": "const result = [{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}].map(city => city.name);"
126
+ },
127
+ {
128
+ "instruction": "Use filter function to get all cities with a population greater than 5 million in an array of city objects.",
129
+ "input": "[{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}]",
130
+ "output": "const result = [{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}].filter(city => city.population > 5000000);"
131
+ },
132
+ {
133
+ "instruction": "Use map function to get the ages of all persons in an array of person objects.",
134
+ "input": "[{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}]",
135
+ "output": "const result = [{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}].map(person => person.age);"
136
+ },
137
+ {
138
+ "instruction": "Use filter function to get all persons younger than 30 in an array of person objects.",
139
+ "input": "[{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}]",
140
+ "output": "const result = [{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}].filter(person => person.age < 30);"
141
+ },
142
+ {
143
+ "instruction": "Use map function to get the full names of all persons in an array of person objects with first and last names.",
144
+ "input": "[{\"firstName\": \"Alice\", \"lastName\": \"Smith\"}, {\"firstName\": \"Bob\", \"lastName\": \"Johnson\"}]",
145
+ "output": "const result = [{\"firstName\": \"Alice\", \"lastName\": \"Smith\"}, {\"firstName\": \"Bob\", \"lastName\": \"Johnson\"}].map(person => person.firstName + ' ' + person.lastName);"
146
+ },
147
+ {
148
+ "instruction": "Use filter function to get all cars of a specific model in an array of car objects.",
149
+ "input": "[{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}]",
150
+ "output": "const result = [{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}].filter(car => car.model === 'Corolla');"
151
+ },
152
+ {
153
+ "instruction": "Use map function to get the populations of all cities in an array of city objects.",
154
+ "input": "[{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}]",
155
+ "output": "const result = [{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}].map(city => city.population);"
156
+ },
157
+ {
158
+ "instruction": "Use filter function to get all cities with a name starting with 'N' in an array of city objects.",
159
+ "input": "[{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}]",
160
+ "output": "const result = [{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}].filter(city => city.name.startsWith('N'));"
161
+ },
162
+ {
163
+ "instruction": "Use map function to get the initials of all persons in an array of person objects with first and last names.",
164
+ "input": "[{\"firstName\": \"Alice\", \"lastName\": \"Smith\"}, {\"firstName\": \"Bob\", \"lastName\": \"Johnson\"}]",
165
+ "output": "const result = [{\"firstName\": \"Alice\", \"lastName\": \"Smith\"}, {\"firstName\": \"Bob\", \"lastName\": \"Johnson\"}].map(person => person.firstName.charAt(0) + person.lastName.charAt(0));"
166
+ },
167
+ {
168
+ "instruction": "Use filter function to get all persons with last names starting with 'S' in an array of person objects.",
169
+ "input": "[{\"firstName\": \"Alice\", \"lastName\": \"Smith\"}, {\"firstName\": \"Bob\", \"lastName\": \"Johnson\"}]",
170
+ "output": "const result = [{\"firstName\": \"Alice\", \"lastName\": \"Smith\"}, {\"firstName\": \"Bob\", \"lastName\": \"Johnson\"}].filter(person => person.lastName.startsWith('S'));"
171
+ },
172
+ {
173
+ "instruction": "Use map function to get the lengths of car models in an array of car objects.",
174
+ "input": "[{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}]",
175
+ "output": "const result = [{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}].map(car => car.model.length);"
176
+ },
177
+ {
178
+ "instruction": "Use filter function to get all cars with a model length greater than 5 in an array of car objects.",
179
+ "input": "[{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}]",
180
+ "output": "const result = [{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}].filter(car => car.model.length > 5);"
181
+ },
182
+ {
183
+ "instruction": "Use map function to get the uppercased names of all cities in an array of city objects.",
184
+ "input": "[{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}]",
185
+ "output": "const result = [{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}].map(city => city.name.toUpperCase());"
186
+ },
187
+ {
188
+ "instruction": "Use filter function to get all cities with a name containing 'o' in an array of city objects.",
189
+ "input": "[{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}]",
190
+ "output": "const result = [{\"name\": \"New York\", \"population\": 8000000}, {\"name\": \"Los Angeles\", \"population\": 4000000}].filter(city => city.name.includes('o'));"
191
+ },
192
+ {
193
+ "instruction": "Use map function to get the lowercase names of all cars in an array of car objects.",
194
+ "input": "[{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}]",
195
+ "output": "const result = [{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}].map(car => car.make.toLowerCase() + ' ' + car.model.toLowerCase());"
196
+ },
197
+ {
198
+ "instruction": "Use filter function to get all cars with a make containing 'o' in an array of car objects.",
199
+ "input": "[{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}]",
200
+ "output": "const result = [{\"make\": \"Toyota\", \"model\": \"Corolla\"}, {\"make\": \"Honda\", \"model\": \"Civic\"}].filter(car => car.make.includes('o'));"
201
+ }
202
+ ]