Last active
May 27, 2022 10:31
-
-
Save jirawatee/3a1f5596fce11ff6fdc6f97e05dc6bdc to your computer and use it in GitHub Desktop.
Get followers by do-while
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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