Last active
May 27, 2022 10:29
-
-
Save jirawatee/da29ae6ab9a40fb26bf68ef4362696c3 to your computer and use it in GitHub Desktop.
Get followers by while loop
This file contains 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() => { | |
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