Question: Lab Description 1 . The HTML page called Lab 2 . html which is part of the same Lab 2 . zip file containing the
Lab Description
The HTML page called Labhtml which is part of the same Labzip file containing the
current PDF document should be renamed with your first name as a prefix. For example:
JimLabhtml
Labhtml contains a script section with a global JavaScript variable called json In addition,
an event handler called startMeUp is also defined and referenced with an onload event in
the tag.
The json variable contains location information about several businesses in the London
area. The objective of this exercise is to extract a subset of the information based on the
following property names:
a name
b address
c categorylabels
d website
You may use letrather than var to declare any variables you need in your solution
although its not required.
You should begin by converting the JSON string to a JavaScript object.
Use document.write to display the above properties and property arrays for each of the
locations in the data. Write the JavaScript code to do this from within the startMeUp event
handler function. Note that categorylabels must be displayed as one per line also see
requirement # below
Finally, as youre displaying the property information for each business, add a new
property to the business object called viewDate This property should have the
value of the current JavaScript date as returned from using new Date;
When youve processed all the businesses, convert your JavaScript object back to a
JSON string and then dump the string at the bottom of your output using
document.write see the attached example
Its important that your solution is flexible enough to work for json data that contains
more or less locations than the example provided and will work with any number of
categorylabels per business.
The following is an example of the required display format:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
