Need this question answered and in html to run on internet explorer... Write Jav
ID: 3768706 • Letter: N
Question
Need this question answered and in html to run on internet explorer...
Write JavaScript statements to accomplish each of the following tasks: Display the value of the seventh element of array f. Initialize each of the five elements of one-dimensional array g to 8. Total the elements of array c, which contains 100 numeric elements. Copy 11-element array a into the first portion of array b, which contains 34 elements. Determine and print the smallest and largest values contained in 99-element floatingpoint array w.
Explanation / Answer
2.Initialize each of the five elements of one-dimensional array g to 8.
for ( var x = 0; x < 5; x++ )
g[ x ] = 8;
3.Total the elements of array c, which contains 100 numeric elements.
var total = 0;
for ( var x in c )
total += c[ x ];
4.Copy 11-element array a into the first portion of array b, which contains 34 elements.
for ( var x in a )
b[ x ] = a[ x ];
5.Determine and print the smallest and largest values contained in 99-element floatingpoint array w.
unction sortNumber( x, y )
{
return x - y;
}
w.sort( sortNumber );
document.write( "Smallest value: " + w[ 0 ] + "<br />" );
document.write( "Largest value: " + w[ 98 ] + "<br />" );
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.