console log every number up to 10 in javascript

One way to console log every number up to 10 in JavaScript is by using a 'for loop':

index.tsx
for(let i=1; i<=10; i++){
    console.log(i);
}
48 chars
4 lines

In the above code block, we have initialized a variable 'i' with a value of 1, and we have created a condition that when 'i' is less than or equal to 10, the loop will continue executing. Finally, in each iteration, we are incrementing the value of 'i' by 1 and console logging its current value until the condition is no longer satisfied.

gistlibby LogSnag