JavaScript Program to print first n odd numbers in descending order

In this program, You will learn how to print first n odd numbers in descending order in JavaScript.


for(init; condition; incr/decr){
    Statement;
}

JavaScript Program to print first n odd numbers in descending order

Example: How to print first n odd numbers in descending order in JavaScript

let n = parseInt(prompt("Enter a number:"));

for (i = n - 1; i >= 0; i--) {
  a = 1 + i * 2;
  console.log(a);
}

Output:

Enter a number:> 10
19  
17  
15  
13  
11  
9  
7  
5  
3  
1