The following code will print only even numbers from 1 to 100 using a while loop in JavaScript:
index.tsx94 chars8 lines
Explanation:
num to zero.num is less than or equal to 100.num is even. If it is, we print it to the console using the console.log() function.num by 1 in each iteration of the loop until it reaches 100.This code will output the even numbers from 1 to 100 to the console.
gistlibby LogSnag