question archive Writ'e JavaScript code to store the number 72

Writ'e JavaScript code to store the number 72

Subject:Computer SciencePrice:3.86 Bought6

Writ'e JavaScript code to store the number 72.6 in an array named samples at index 3.

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Explanation

let samples = []  //create empty array

samples[3] = 72.6; // store value at index 3

// Tested Code

console.log("Length of array: "+samples.length); // print length; 4

console.log("At index 3: "+samples[3]); //print 72.6

Complete example:

<!DOCTYPE html>

<html>

<body>

<p id="demo"></p>

<script>

let samples = [] //create empty array

samples[3] = 72.6; // store value at index 3

document.getElementById("demo").innerHTML = samples[3];

</script>

</body>

</html>

Please see the attached file for the complete solution