I am using Google cloud api to add companies to Google Talent Solution. They are return data through a promise. I need to return the response.name value when the promise is resolved. But the value that gets return from the .then() method is:
Promise { response.name }
How can I get the response.name value out of the promise so I can actually use it.
createGoogleCompany: function(projectId, tenantId, displayName, externalId) {
  const client = new talent.CompanyServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const displayName = 'My Company Name';
  // const externalId = 'Identifier of this company in my system';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const company = {
    displayName: displayName,
    externalId: externalId,
  };
  const request = {
    parent: formattedParent,
    company: company,
  };
  return promise = client.createCompany(request)
    .then(responses => {
      const response = responses[0];
      console.log(`Created Company`);
      console.log(`Name: ${response.name}`);
      console.log(`Display Name: ${response.displayName}`);
      console.log(`External ID: ${response.externalId}`);
      return response.name
    })
    .catch(err => {
      console.error(err);
    });
},
var nameValue = createGoogleCompany(data,data2,data3,data4)createGoogleCompany(data).then((nameValue) => { console.log("Name Value", nameValue); });
^^ this still returns a promise object that is pending.
 
    