bj2jung / Smart-Player-Swap-Yahoo-Fantasy-B-ball-9-CAT

Smart Player Swap for Yahoo Fantasy Basketball 9-CAT
https://chrome.google.com/webstore/detail/dgipljpilhcifdfejhgapkemciknebja
1 stars 0 forks source link

How does this work? #3

Closed hyolyeng closed 5 years ago

hyolyeng commented 5 years ago

https://github.com/bj2jung/Yahoo-Fantasy-Basketball-Player-Comparison-Chrome-Extension/blob/c28b8e0d537ca6aae359a690b7ac310399da49c2/content.js#L530

Isn't outerArray gonna be empty except for the last element, which will contain an array?

You also don't need a new Promise here either- fetch already returns a Promise. If you return the innerArray inside the then() clause then it'll be the same as the Promise doing resolve(innerArray)

bj2jung commented 5 years ago

In this for loop the iterator "n" starts at 1 rather than 0 (because CSS nth-child starts at index 1) and it populates outerArray as desired.

I'll look at the Promise/fetch issue in Issue #1