so i am working on emptying a property (polygon) from an array of objects
deleteAllZones = () => { let assetVal = this.asset.$$state.value let mapId = this.siMapUtils.mapId; console.log('load',assetVal) var polygons = assetVal.forEach(function (a) { console.log('a.poly',a.polygon) return a.polygon }) console.log('test',polygons); let message = this.$filter('translate')('SI-MESSAGES.DELZONE-MSG'); let title = this.$filter('translate')('SUBHEADER.DELZONE-TITLE'); let button = this.$filter('translate')('BUTTON.DELETE'); this.siAlertDialog.confirm(message, title, button) .then(()=>{ this.siGeography.removePolygonFromMap('showAllAreas', mapId).then(()=>{ this.toastIt.simple(this.$filter('translate')('SI-MESSAGES.ZONE-DELETED')) }) }) }
in var polygons i was able to iterate and console just the polygon property of all the object in the array (a.polygon) . But its returning undefined (return a.polygon) when i console 'polygons', but console.log('a.poly',a.polygon) is showing the array in the console
var polygons = assetVal.forEach(function (a) { console.log('a.poly',a.polygon) return a.polygon })
eventually i want to say polygons = null when this function execute