What is the correct fix?
function findUser(id: number, users: {id: number}[]) {
return users.find(u => u.id = id);
}
- Change
findtofilter - Change
id: numbertoid: any - Change
u.id = idtou.id === id - Add a return type annotation
The predicate assigns instead of comparing; use
Play Problem Solving ▸
===.