Open the hg_product.js file and take some time to review the variables and values stored in the file, but do not make any changes to the file content.
Variables
Go to the hg_report.js file. First, you write information about the game that will be displayed in the web page. Declare a variable named gameReport. Within the gameReport variable, store the following HTML code.
title
By: manufacturer
Product ID id
List Price price
Platform platform
ESRB Rating esrb
Condition condition
Release release
summary
where title , manufacturer , id , price , platform , esrb , condition , release and summary use the values from corresponding variables in the hg_product.js file.
Game Report
Display the value of the gameReport variable in the inner HTML of the first (and only) article element in the document.
(Hint : Use the getElementsByTagName() method, referencing the first item in the array of article elements.)
Ratings
Next, you write the information from the customer ratings. Start by calculating the average customer rating of the game. Declare a variable named ratingsSum setting its initial value to 0.
Declare a variable named ratingsCount equal to the length of the ratings array.
Create a for loop to loop through the contents of the ratings array. Each time through the loop, add the value of current ratings value to the value of the ratingsSum variable.
After the for loop, declare the ratingsAvg variable, setting its value equal to the value of the ratingsSum variable divided by the value of ratingsCount.
Declare a variable named ratingReport. Set its initial value to the text string
Customer Reviews
average out of 5 stars ( count reviews)
where average is the value of the ratingsAvg variable and count is the value of ratingsCount.