{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-08-31T02:29:58-04:00", "answer_date": "2024-08-31 02:29:58", "is_docs_available": "", "is_excel_available": "", "is_pdf_available": "", "count_file_available": 0, "main_page": "student_question_view", "question_id": "8775858", "url": "\/study-help\/questions\/for-this-discussion-we-will-be-looking-at-a-simple-8775858", "question_creation_date_js": "2024-08-31T02:29:58-04:00", "question_creation_date": "Aug 31, 2024 02:29 AM", "meta_title": "[Solved] For this discussion, we will be looking a | SolutionInn", "meta_description": "Answer of - For this discussion, we will be looking at a simple HTML file (index.htm) and an external JavaScript file (disc_3.js). | SolutionInn", "meta_keywords": "discussion,will,looking,simple,html,file,indexhtm,external,javascript,disc,3,js", "question_title_h1": "For this discussion, we will be looking at a simple HTML file (index.htm) and an external JavaScript file (disc_3.js). Open both files in your text", "question_title": "For this discussion, we will be looking at a simple HTML file", "question_title_for_js_snippet": "For this discussion, we will be looking at a simple HTML file (index htm) and an external JavaScript file (disc 3 js) Open both files in your text editor and examine their contents also open index htm in a web browser The HTML file and JavaScript file work together to allow the user to enter their favorite car makes into the textbox The addCar() function in disc 3 js then adds the car makes to an array Once the array reaches four entries, the array contents are output to a element with an ID of output In its current form, disc 3 js contains three errors having to do with arrays, loops, and if statements For this discussion, please do the following 1) Identify all three errors 2) Explain why the errors prevent the code form working 3) Provide solutions to each error Please upload your corrected JavaScript file as LASTNAME FIRSTNAME disc 3 js Content of index htm Discussion 3 Discussion 3 Favorite Cars Enter your four favorite cars into the textbox Content of disc 3 js This program uses an array to store a list of favorite car makes and then outputs the contents to an HTML page var cars Array to hold car makes (Error 1 not an array) var i 0 Index The addCar() function will add a car from the textbox to the cars array The array is output once it contains 4 entries function addCar() if (i 4) cars i input value input value i if (i 4) Error 2 assignment instead of comparison displayCars() The displayCars() function uses a for loop to loop through the cars array and output its contents to the element with ID output function displayCars() Reference the element with ID output for simpler code var output document getElementById( output ) output innerHTML Your list is for (var j 1 j cars length j ) Error 3 j should start at 0 output innerHTML cars j if (j cars length 1) output innerHTML , Backward compatible event listener if (document getElementById( submit ) addEventListener) document getElementById( submit ) addEventListener( click , addCar, false) else if (document getElementById( submit ) attachEvent) document getElementById( submit ) attachEvent( onclick , addCar) ", "question_description": "
For this discussion, we will be looking at a simple HTML file (index.htm) and an external JavaScript file (disc_3.js). Open both files in your text editor and examine their contents; also open index.htm in a web browser. The HTML file and JavaScript file work together to allow the user to enter their favorite car makes into the textbox. The addCar() function in disc_3.js then adds the car makes to an array. Once the array reaches four entries, the array contents are output to a
element with an ID of \"output\".<\/p>
In its current form, disc_3.js contains three errors having to do with arrays, loops, and if statements. For this discussion, please do the following: 1) Identify all three errors 2) Explain why the errors prevent the code form working 3) Provide solutions to each error<\/p>
Please upload your corrected JavaScript file as LASTNAME_FIRSTNAME_disc_3.js<\/p>
<\/p>
Content of index.htm:<\/p>
Favorite Cars<\/b><\/p>
Enter your four favorite cars into the textbox. <\/p>
<\/p>
<\/p>
<\/p>
<\/p>