Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Last active May 27, 2022 10:31
Show Gist options
  • Save jirawatee/3a1f5596fce11ff6fdc6f97e05dc6bdc to your computer and use it in GitHub Desktop.
Save jirawatee/3a1f5596fce11ff6fdc6f97e05dc6bdc to your computer and use it in GitHub Desktop.
Get followers by do-while
const main = async() => {
let result = {}
let next = ''
const valueArray = []
let round = 0
do {
result = await getFollowerIds(next)
for (const userId of result.userIds) {
valueArray.push(userId)
}
next = result.next
round++
}
while (result.next)
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