Given two arrays:
var users = [{ name: 'Alice', typeID: 1 }, { name: 'Bob', typeID: 2 }, { name: 'Carol', typeID: 3 }];
var authorized = [{ typeID: 1 }, { typeID: 2 }];
I would like to know the simplest way to get all users having typeId that is present in the authorized array.
In this case the result should be:
[{ name: 'Alice', typeID: 1 }, { name: 'Bob', typeID: 2 }]
.mapand.filterArray.prototype.filer()and a loop