"dwfrm_shipping_shippingAddress_addressFields_city"
city
. Я могу сделать так:const b = "dwfrm_shipping_shippingAddress_addressFields_city";
b.substr(b.length - 8) -> city
const b = "dwfrm_shipping_shippingAddress_addressFields_states_stateCode";
b.substr(b.length - 8) -> tateCode, а надо stateCode
b.split('_')[b.split('_').length-1] // последний элемент массива: city либо stateCode