fork download
  1. const oddArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  2.  
  3. function oddity (){
  4. let j = oddArray.length;
  5. for (i = 0; i < j; i++){
  6. let k = Math.ceil(Math.random() * 10);
  7. while (k % 2 === 0) {
  8. k = Math.floor(Math.random() * 10);
  9. }
  10. oddArray[i] = k;
  11. }
  12. console.log(oddArray);
  13. }
  14.  
  15. oddity ();
Success #stdin #stdout 0.03s 16636KB
stdin
Standard input is empty
stdout
9,5,3,7,1,1,7,9,5,1