javascript - I'm trying to write a function that Randomizes a number (range 0..100), then prints all the odd numbers from 40 to that one -
i'm new javascript , i'm struggling basics. can't code work.
i'm trying create function (the following taken form exercise i'm doing) randomizes number (range 0..100), prints odd numbers 40 one. if number smaller 40, print numbers down randomized 1 (i.e. if result 37, should print: 40, 39, 38, 37).
your input appreciated.
var sol3 = function() { var n = math.floor(math.random()*100); if (n > 40) { for( var = 41; <= 100; i++2); console.log(i); } else if (n < 40) { (var = 39; <= 40; i--2); console.log(i); } return i; }; so13();
problems code -
i++2incorrect;afterforincorrecti--2incorrect- you calling
sol13()number 1 there not letter l return iworks!
var sol3 = function () { var n = math.floor(math.random() * 100); console.log("n = " + n); if (n > 40) { (var = 41; <= n; += 2) console.log(i); } else if (n < 40) { (var = 40; >= n; i--) console.log(i); } return i; }; sol3();
Comments
Post a Comment