Question: using JavaScript. Use the Following functions create calls to each of the functions then display the results. use the following data for arguments: a. 15,

using JavaScript. Use the Following functions create calls to each of the functions then display the results. use the following data for arguments:

a. 15, 100

b, 80, 50

c. [75, 60, 100, 90]

d. 10, 20

Functions:

A.: function larger(var1,var2) {

var1 = parseInt(var1, 10);//don't forget to add the base

var2 = parseInt(var2, 10);

var max = var1>var2 ? var1 : var2;

return max;

}

B: function average(var1,var2) {

var1 = parseInt(var1, 10);//don't forget to add the base

var2 = parseInt(var2, 10);//don't forget to add the base

var avg = (var1+var2)/2.0;

return avg;

}

C: function averageLst(elmt) {

var sum = 0;

for( var i = 0; i < elmt.length; i++ ){

sum += parseInt( elmt[i], 10 ); //don't forget to add the base

}

var avg = sum/elmt.length;

return avg;

}

D: function randNum(min, max) {

return Math.floor(Math.random() * (max - min + 1)) + min;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!