How can update count (count++)

Viewed 37

Hi I have a for loop (i) if i = 0 is less than the sent value (count) < count; I am doing i++ process. But not all transactions return correctly and when I catch an error, it is missing. In the error I caught, I want to increase the count value and add it to the for loop. How can I do it?

let count = parseInt(req.body.count);


for (let i = 0; i < count; i++) {
  console.log(count);
  if (count > totalUser) {
    count = totalUser
  }

  const client = new Twitter({
    consumer_key: 'CjulERsDeqhhjSme66ECg',
    consumer_secret: 'IQWdVyqFxghAtURHGeGiWAsmCAGmdW3WmbEx6Hck',
    access_token_key: Users[i].tAccesToken,
    access_token_secret: Users[i].tAccesTokenSecret,
  });

  client.post('favorites/create', {
    id: tweetID
  }, function(error, tweet, response) {
    // console.log(tweet.errors);
    if (error) {
      count++
      // I want count++ but for loop not added count++

    } else {
      console.log('SUCCESS');
    }

  });

}, i * 75);
0 Answers
Related