Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Last active May 27, 2022 10:29
Show Gist options
  • Save jirawatee/da29ae6ab9a40fb26bf68ef4362696c3 to your computer and use it in GitHub Desktop.
Save jirawatee/da29ae6ab9a40fb26bf68ef4362696c3 to your computer and use it in GitHub Desktop.
Get followers by while loop
const main = async() => {
const valueArray = []
let result = {}
let next = ''
let round = 0
while(next != undefined) {
result = await getFollowerIds(next)
for (const userId of result.userIds) {
valueArray.push(userId)
}
next = result.next
round++
}
console.log('Round: ' + round)
console.log(valueArray.length)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment