Welcome to Westonci.ca, the place where your questions find answers from a community of knowledgeable experts. Discover comprehensive answers to your questions from knowledgeable professionals on our user-friendly platform. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.
Sagot :
Answer:
Hard to read this so im just going to write as I read.
Explanation:
// Create array
let hobbies = ["string 1", "string 2", "string 3"];
// Pop an alert for each hobby
for (let i = 0; i < hobbies.length; i++) {
window.alert(hobbies[i]);
}
// Or to show all at once
windows.alert(hobbies[0] + "\n" + hobbies[1] + "\n" + hobbies[2]);
// Creating myHobby variable
let myHobby = hobbies[0];
// Changing 'hx' elements innerHTML to the 'myHobby' variable
document.getElementByID("hx").innerHTML = myHobby;
// Changing the 'hz' element to the third index of the 'hobbies' array.
// Array index's start at 0, so 1 2 3 is equal to 0 1 2
document.getElementByID("hz").innerHTML = hobbies[2];
// if you referenced hobbies[2]; it would throw an error saying you are accessing a non-existent index. Not those exact words but something like that, lemme know if you need anymore help. This is for JavaScript BTW and it is not tested so there could be Errors
Thank you for your visit. We are dedicated to helping you find the information you need, whenever you need it. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Get the answers you need at Westonci.ca. Stay informed with our latest expert advice.