Array Practice 1. Write a function named attAvg that accepts an array of numbers
ID: 3693038 • Letter: A
Question
Array Practice 1. Write a function named attAvg that accepts an array of numbers and returns their average. y Practice 2. Write a function named atrMax (ii) Arra that accepts an array of numbers and returns the largest number in the array. isMember that accentswie a function named a string -and returns true if the string is contained in the array, false otherwise. You may solve this problem using a loop, or by (iii) Array Practice 5. Write a function named isMember that accepts two arguments-an array of strings and using the Array jndexQf methodExplanation / Answer
<html>
<head>
<script language="Javascript">
var a=new Array(),s=0,av,i,max;
function arrAvg()
{
for(i=0;i<10;i++)
{
a[i]=prompt("Enter no");
s=s+eval(a[i]);
}
av=s/10;
document.write("<br>"+"Average is"+av);
}
function arrMax()
{
max=a[0];
for(i=0;i<10;i++)
{
if(eval(a[i])>max)
max=eval(a[i]);
}
document.write("<br>"+"Largest number is "+max);
}
</script>
</head>
<body>
<script language="Javascript">
arrAvg();
arrMax();
</script>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.