Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Examine the supplied ( ch 0 8 - proj 0 3 . html ) file. It provides the markup for a sample company contained within

Examine the supplied (ch08-proj03.html) file. It provides the markup for a
sample company contained within a card (i.e., the rectangular box). You are
going to eventually dynamically generate the card markup. If you follow the
same structure as the sample, the supplied CSS will style it similar to that
shown in Figure 8.32.
2. You have been supplied with a JSON file named companies.json. Convert this
file into an array of company objects using JSON.parse.
3. Create a constructor function (see Section 8.8.6) named CompanyCard which
will be passed a company object from the JSON data. Within the constuctor
function, create properties named symbol, name, day50, day200, revenue,
marketCap50, marketCap200, equity, and tags, whose values are extracted
from the passed company object.
4. Add a method to CompanyCard named currency() using arrow syntax that is
passed a number named num and returns a currency formatted number using
the Intl.NumberFormat() function (lookup the details online). Add another
method to CompanyCard named billions() using arrow syntax that is passed
a number named num and returns a currency using compact notation, also
using the Intl.NumberFormat() function. This will display the large number in
the data set as a short billions or millions value.
5. Add a method to CompanyCard named outputCard() that uses the methods
and properties created in the two previous steps to output the markup for a
single company card.
6. Create a function named outputCompanyCards that loops through the
company data, instantiate a CompanyCard object using the new keyword, and
then call the outputCard() method of the CompanyCard object.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions