There is such a multi-dimensional array that gets the value of index 1 in each subarray and calculates the sum of all the values.

I use loop traversal to figure it out, but I feel that there is too much code. I wonder if there is a better way to calculate es6

var array = [
    ["18.8000", "10.0000"]
    ["20.0000", "10.0000"]
    ["20.1000", "10.0000"]
    ["20.2000", "1370"]
    ["20.6000", "2120"]
    ["20.9000", "1480"]
]
let total = 0;
  for (let index = 0; index < array .length; indexPP) {
    const element = +array[index][1];
    total += element;
  }
  console.log(total);
Mar.12,2021

array.reduce (function (sum,item) {return sum + = + item [1]}, 0)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37f05-2b927.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37f05-2b927.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?