我有以下几点:
Ionic:
ionic (Ionic CLI) : 4.7.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.1.2
@angular-devkit/build-angular : 0.13.7
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.7
@ionic/angular-toolkit : 1.4.1
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, browser 5.0.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 10 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/pds/Library/Android/sdk)
NodeJS : v11.6.0 (/usr/local/bin/node)
npm : 6.5.0-next.0
OS : macOS Mojave
Xcode : Xcode 10.2 Build version 10E125
Run Code Online (Sandbox Code Playgroud)
根据此文档:https://ionicframework.com/docs/api/item#detail-arrows,为了不在 …
我有以下代码:
if (this.places.length) {
console.log(this.places);
var myData = this.places.map(({ points }) => points);
var myTotal = 0; // Variable to hold your total
for(var i = 0, len = myData.length; i < len; i++) {
myTotal += myData[i][1]; // Iterate over your first array and then grab the second element add the values up
}
console.log(myTotal);
}
Run Code Online (Sandbox Code Playgroud)
我有一个对象
,我需要从该对象中提取所有数组,并从该数组中仅提取一个特定值,例如点。
主要目标是将所有点求和并保存到一个新变量中。上面的代码不起作用。