gvwilson / sdxjs

Software Design by Example with JavaScript
Other
49 stars 12 forks source link

Dead code in table-performance.js #20

Closed juananpe closed 1 year ago

juananpe commented 1 year ago

I think that lines 97-101 represent dead code. The result object is empty (it has been initialized as an empty object in the previous line) so those lines are not really doing anything, are they?

https://github.com/gvwilson/sdxjs/blob/e19acd450e52cecd8ddbea704596c74401691cb2/en/src/data-table/table-performance.js#L96-L101

Related to this same function, its code is replicated in the last listing of section 6.1. :

image

But this line: https://github.com/gvwilson/sdxjs/blob/e19acd450e52cecd8ddbea704596c74401691cb2/en/src/data-table/table-performance.js#L102 is using a table attribute (table.label_1) that has not been introduced in the text yet.

I was thinking about a solution that could work in both places, but the alternative code seems overkilling:

for (let iR = 0; iR < table[Object.keys(table)[0]].length; iR += 1) {