For the given array object
map = [
{
"userId":"2345454",
"socketIds":["asd2324","asdfs3242"]
},
{
"userId":"353453",
"socketIds":["asdf3456","as234s","sfsdf324"]
}
];
I get a new socket Id and a user Id to be added to the map. How do I search through the array for the user Id. And push the socket Id if it exists to the element, or add a new element with the socket Id and the user Id to the array if no element matches the userId provided?