How to find if object property exists in an array with Lodash and JavaScript?

To find if object property exists in an array with Lodash and JavaScript, we use the has method.

For instance, we write

const countries = { country: { name: "France" } };
const isExist = _.has(countries, "country.name");

to call has with the countries object and the property to look for in each object.

Therefore, isExist is true since country.name is in the countries object.