About 71,100 results
Open links in new tab
  1. loops - How to do a script for odd and even numbers from 1 to …

    Dec 29, 2016 · First of all if you want even number from 1 to 1000 your iteration variable should start from 1, not 0. :) To write odd numbers after even ones you can just put another loop …

  2. Print odd numbers 1-100 (JavaScript - No extra conditional …

    Nov 4, 2018 · for (let i = 1; i < 100; i+=2) { console.log(i); } It's a for loop. You could do: console.log (1); console.log (3); .... console.log (99); That's why we use for loop. For loop …

  3. Iterate Odd Numbers With a For Loop.md - GitHub

    Push the odd numbers from 1 through 9 to myArray using a for loop. // Example var ourArray = []; for (var i = 0; i < 10; i += 2) { ourArray.push(i); } // Setup var myArray = []; // Only change code …

  4. JavaScript for Loop - W3Schools

    JavaScript supports different kinds of loops: The for statement creates a loop with 3 optional expressions: Expression 1 is executed (one time) before the execution of the code block. …

  5. Iterate Odd Numbers With a For Loop1 - The freeCodeCamp …

    Apr 1, 2019 · So if you want to iterate through odd number from 1 to 9 you have to init you loop var to 1 and iterate untill 9 which means x <= 9 or x < 10 and for the incrementation i let you …

  6. freeCodeCamp Challenge Guide: Iterate Odd Numbers With a For Loop

    Aug 3, 2017 · Iterate Odd Numbers With a For Loop Hints Hint 1 After string // Only change code below this line. we add for loop. You need to copy loop from the top: for (var i = 0; i < 10; i += …

  7. JavaScript for Loop - Stack Overflow

    Jun 13, 2012 · Write odd numbers from 1 to 100.. And I used this piece of code for this: var i=1; for (i=1; i < 51; i = i + 1) { document.write (i -1 + i ); document.write ("<br />"); } Now, can so...

  8. Print all Odd Numbers in a Range in JavaScript Array

    May 20, 2024 · Example: The example uses the for Loop to print all odd numbers in a range of 1 to 50 in a JavaScript array. The forEach method to go through each element of the array and …

  9. Iterate Odd Numbers With a For Loop - The freeCodeCamp Forum

    Jun 12, 2018 · You can start your variable (i) at any number (it does not have to be zero, the condition to exit the loop (could be until i =20, or while its under 100, etc) AND also, how the …

  10. JavaScript 1: for loops - Teaching Materials

    Write a for loop that will iterate from 0 to 20. For each iteration, it will check if the current number is even or odd, and report that to the screen (e.g. "2 is even").

  11. Some results have been removed