Here is the code snippet that I am struggling with:
users = [{
"userid": "45",
"name": "steve"
}, {
"userid": "32",
"name": "john"
}];
getuser = users.flatMap(user => user.userid === '32' ? user.name : []);
result = getuser.toString();
console.log(result.replaceAll("\"", ""))
For the live example, click this link: https://jsfiddle.net/Ldob8vz2/3/
I expect the output to be just john
without quotation marks, however, I am having trouble removing them. Can anyone explain why?