Friday 19 May 2017

Guidance regarding a custom bidding system with a loop (for or while)?

Basically, I want to create something that will constantly subtract from a value while a certain condition is true. It's a for a bidding system that continues to subtract from your "credit balance" while you're the highest bidder. I don't think a while loop will work for this since I need the user to be able to access the page even while the "loop" is subtracting their credits.

This is part of what I've tried (I'm probably not even close) but when the loop is going, the server stays busy:

while (doc.highestBidder === req.session.passport.user) {
  credits = credits - 1;
}



via kolbykskk

No comments:

Post a Comment