I need a javascript for loop it should print 10 to 1 like it should print still 1 -


i need javascript loop should print 10 1 should still 1.

my js code:

var b = ""; var inc = ""; var k = 10; for(a = k;a >= 1; a--){ for(i=k; i<=1; a++) { console.log(parseint(inc)); } } console.log(parseint(b));

what expecting is:

10 9 8 7 6 5 4 3 2 1
9 8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
7 6 5 4 3 2 1
6 5 4 3 2 1
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

use following loop,

for (i = 11; > 1; i--) {     (j = - 1; j > 0; j--) {         console.log(j)     } } 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -