Write a function where the name of the function is foo which has three input par
ID: 3574145 • Letter: W
Question
Write a function where the name of the function is foo which has three input parameters called index, parm1, and parm2. The body of foo uses document write to print out the values of indez, parm1, and parm2 into the first three columns of the current row of a table. This function should be able to be called each time we want to write another row to the table. function foo (index, parm1, parm2) {Write a function called barfoo that takes no inputs and generates a random integer between the 4 and 14, and returns that number as its result. function barfoo() {Explanation / Answer
6 answer:
<html>
<head>
<script lang= "javascript">
function foo(index,parm1,parm2){
document.write("<table border='1'><tr><td>"+index+"</td> <td>"+parm1+"</td> <td>"+
parm2+"</td></tr></table>");
}
document.getElementById("demo").innerHTML = foo(1,2,5);
</script>
</head>
<body>
<p id="demo"> </p>
</body>
</html>
7 answer :
<html>
<body>
<p id="demo"> </p>
<script lang= "javascript">
function barfoo(){
return ( Math.ceil(Math.random() * (14 - 4) + 4));
}
document.getElementById("demo").innerHTML = barfoo();
</script>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.