function skl() {
var trct = 100;
var amt = 100;
while (amt == trct)
{
funk();
amt += 50;
trct = counttr();
}
console.log(amt, friendct);
};
Initially there are 100 <tr>s
funk() scrolls down to reveal 50 more <tr>s
counttr() counts the amount of TRs and returns the amount.
The point of the function is to scroll down until their is no more TRs. When there are no more <tr>s the function will still add 50 to amt but counttr() wont add 50, so when the for loop evaluates the numbers will no longer be equal to each other and the loop ends.
Edit – The loop only runs once and displays “100 150” meaning the value of trct didn’t change.
The second clause in a for-loop condition is tested on every iteration, and when it is no longer true, the loop is over.
Your for loop looks like this:
If
amt != trctafter the first iteration, the for loop never runs a second time. You’ll need to figure out why that’s not the case. I would log three things a the end of the for loop, fro some visibility:amt,trct, andamt == trct.It’s possible that the counttr() function is returning something that you’re not expecting