index.tsx167 chars8 lines
In this code block, we initialize a variable sum
to 0. We then loop through numbers from 1 to 100 using a for loop. For each number, we use an if statement to check if it is divisible by 3 or 5 using the modulo operator. If it is, we add it to the sum
variable using the addition assignment operator. Once the loop has finished, we use document.write()
to print the sum to the page.
gistlibby LogSnag