Comparing and combining
===, !==, >=, !, &&, ||, ? :, and more — 10 exercises
Exercise 1 / 10
0 solved
Exercise 1/ 10
===
RuleWhether left and right are the same (true / false)
Data(members)
const members = [ { id: 1, name: "Emma", plan: "Paid", age: 28, points: 120, nickname: "Em" }, { id: 2, name: "Jack", plan: "Free", age: 17, points: 0 }, { id: 3, name: "Lily", plan: "Paid", age: 35, points: 80, nickname: "Lil" }, { id: 4, name: "Tom", plan: "Free", age: 20, points: 300 }, ]
Example
// The names of members on the "Paid" plan members.filter((m) => m.plan === "Paid").map((m) => m.name)
→ ["Emma", "Lily"]
The ids of members who are exactly 20
In plain words:Look at each member one at a time, keep only the ones where "Is the age the same as 20?" is true (filter), and make an array of just their ids (map)
Expected result
[4]JavaScript
Solve it to continue