Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript for loop Display Numbers from 1 to 5

// program to display numbers from 1 to 5
const n = 5;

// looping from i = 1 to 5
// in each iteration, i is increased by 1
for (let i = 1; i <= n; i++) {
    console.log(i);     // printing the value of i
}
Source by onecompiler.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #loop #Display #Numbers
ADD COMMENT
Topic
Name
3+2 =