Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JavaScript Problems I have a pile of JavaScript problems for you in this assignm

ID: 3751188 • Letter: J

Question

JavaScript Problems I have a pile of JavaScript problems for you in this assignment. Do all of these You may throw them all in ooe file wath should be cake. If not, they might be a bit tougher your name at the top as a comment Do each problem as itself so it's easy for me to test! When I say print/display, use console log0. If you've had 141 already, these 1. Make a function that takes in a single input assumed to be an integer. Run a for loop that prints "HI BOB an amount equal to that integer. 2. Do the same, but pass two parameters, the amount and a message to be displayed. Instead of BOB, print the passed message the desired amount of times. 3. Write a function that displays the following table... 12345 6789 10 11 12 13 14 15 Moatig point vakue assumed to be a sar ating Uise decásons Consider using seich 4 wite a tunction that daplays outpur seccording to this table Pas in Not Great Alright Dope 4-5

Explanation / Answer

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
   function main()
   {
       var val;
       val =prompt("enter no of times you want to print");    //asking user to number of times to print
       var num=parseInt(val);//prompt gives every input in the form of string so convert it into int
       display1(num);//calling function
      
       var str;
       str=prompt("enter string to print number of times");
       display2(num,str);//calling function with above number and given string
      
       displaytable(); //calling function to print table
      
       var rating;
       rating=prompt("enter rating");
       var rat;
       rat=parseFloat(rating);
       findrating(rat);//calling fuction to print the rating
      
   }
   function display1(val)
   {
       var i;
       for(i=0;i<val;i++)
       {
           console.log("HI BOB");
       }
   }
   function display2(val,str)
   {
       var i;
       for(i=0;i<val;i++)
       {
           console.log(str);
       }
   }
   function displaytable()
   {
       console.log("1 2 3 4 5 ");
       console.log("6 7 8 9 10 ");
       console.log("11 12 13 14 15");
   }
   function findrating(val)
   {
       if(val >=0 && val <=2.5)
           console.log("Not Great");
       else if(val >2.5 && val <=4)
           console.log("Alright");
       else if(val >4 && val <=5)
           console.log("Dope");
       else if(val ==0)
       {
           console.log("Terrible");
       }
   }
  
</script>
<body>
</body>
</head>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote