JavaScript – For Loops 2

Directions: In JavaScript, using the digits 0 to 9 at most one time each, place a digit in each box to find then total would have the largest number printed to the screen.

Hint

Think of where total begins, how many times the loop iterates, and how it increments.

Answer

79; total = 7; var i =0; i < 8; i+=1 and total +=9

79; total = 7; var i =0; i < 9; i+=1 and total +=8

Source: Jesse Darcy

Print Friendly, PDF & Email

Check Also

JavaScript – For Loop 1

Directions: In JavaScript, using the digits 1 to 9 at most one time each, place …

Leave a Reply

Your email address will not be published. Required fields are marked *