Browse Source

Learning to use reduce better

craigsdennis 9 năm trước cách đây
mục cha
commit
a025057c82
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      back-end/rom_comm.js

+ 1 - 1
back-end/rom_comm.js

@@ -312,7 +312,7 @@ class RomComm extends EventEmitter {
 
     flashSpecifications(specs) {
         let totalBytes = specs.reduce((counter, spec) => {
-            counter += spec.buffer.length;
+            return counter + spec.buffer.length;
         }, 0);
         let details = {
             totalFiles: specs.length,