How to execute first 10 odd numbers in javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to execute first 10 odd numbers in javascript

I need a full code how to solve it

7th Jul 2020, 12:11 PM
Muskan
10 Answers
+ 8
Its is very simple u need one loop and loop start form 0 to 10. And u need condition for odd Numbers if number%2! ==0 then print Numbers. This hint is enough to solve this problem
8th Jul 2020, 7:00 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 8
Muskan welcome
8th Jul 2020, 7:05 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
Do not ask for code pls,link your code ,so we can see what you attempted and provide you further assistance
7th Jul 2020, 12:21 PM
Abhay
Abhay - avatar
+ 1
Muskan I visited your profile just now. Seems you only just getting started, so I would advise you to finish the course for now, and put the idea on hold. At least until you get to "Conditionals and loops" chapter, where you will be learning about repetition : )
7th Jul 2020, 1:00 PM
Ipang
0
I don't even know which typ of code is written their
7th Jul 2020, 12:22 PM
Muskan
0
You could've been more descriptive with the question actually. How "execute first 10 odd numbers" sound to you? Besides, there could be more to it, for example, the range bounds, whether to begin from zero, or any number. Range direction also is unclear here, is it 10 odd numbers upwards or backwards from the initial number : )
7th Jul 2020, 12:28 PM
Ipang
0
Ipang upward
7th Jul 2020, 12:30 PM
Muskan
0
<script> for(let i=0; i<=10; i++) { if(i%2!==0){ console.log(`even numbers ${i} `) } } </script> This is the code you are looking for. You can also do this. If you know loops and if statements. Before asking questions. Try by yourself. If get stuck. Link your code with your question here on Q&A Discussion.
7th Jul 2020, 3:54 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
8th Jul 2020, 7:03 PM
Muskan
0
🐍Sizuna 🐉 thank you for the cooperation
8th Jul 2020, 7:03 PM
Muskan