At Westonci.ca, we make it easy to get the answers you need from a community of informed and experienced contributors. Explore thousands of questions and answers from a knowledgeable community of experts on our user-friendly platform. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.
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. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.