'Including a specific field from a specific item from an array

I have the following function:

function processMegaventorySalesOrder(salesOrder) {
  let endUser = salesOrder["SalesOrderContactPerson"]
  let clientName = salesOrder["SalesOrderClientName"]
  let salesOrderNo = salesOrder["SalesOrderNo"]
  let referenceNo = salesOrder["SalesOrderReferenceNo"];
  let creationDate = new Date(
      Number(salesOrder["SalesOrderCreationDate"].substring(6, 19)));
  let orderTags = salesOrder["SalesOrderTags"];
  salesOrder["SalesOrderDetails"].forEach(function (order) {
    let model = order["SalesOrderRowProductSKU"];
    let quantity = order["SalesOrderRowQuantity"];
    let unitPrice = order["SalesOrderRowUnitPriceWithoutTaxOrDiscount"];
    let value = order["SalesOrderRowTotalAmount"];
    let remainingToBeShipped = order["SalesOrderRowQuantity"]
        - order["SalesOrderRowShippedQuantity"];
    let remainingToBeInvoiced = order["SalesOrderRowQuantity"]
        - order["SalesOrderRowInvoicedQuantity"];
    let category = productToCategoryMap[order["SalesOrderRowProductSKU"]];
    megaventoryOutput.push(
        [salesOrderNo, clientName, referenceNo, creationDate, model, quantity,
          unitPrice, value, orderTags, remainingToBeShipped,
          remainingToBeInvoiced, category, endUser, state]);
  });
}

It works fine now, but I need to add the state to it. The state is found nested a bit further into the array I am working from https://apibeta.megaventory.com/v2017a/documentation/index.html#!/SalesOrder/postSalesOrderSalesOrderUpdate_post_3 shows it nested under SalesOrderAddresses(State), however there are two items under SalesOrderAddresses usually, AddressType="Billing" and AddressType="Shipping1". I want to only select the state that is with the "Shipping1" address.

I'm pretty new and migrating outside of Google Sheets and into Google Scripts, so please let me know if I'm phrasing this wrong or if there is any other information that would be helpful. Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source