Input element values are string. For your code to work, you must declare your data.userId
as strings.
So it must be:
const data = [
{ userName: "Jon", userId: "1", admin: true },
{ userName: "Mike", userId: "2", admin: false },
{ userName: "Martha", userId: "3", admin: false },
];
If you don't want to use strings as userId, you should change the logical operator of your conditional statement into ==
instead of ===
so it would ignore data types.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…