<table>
.
<th>
defines a tables headers<tr>
defines the rows of data<td>
defines the data in the tablethis
to the properties you define within the constructorthis
differ when used in an object literal versus when used in a constructor?
this
can only refer to the object in which it is embeddedthis
, allowing you to use it throughout all objects created by the constructornull
is returned)nationality
. If it couldn’t find it in the parents’ records, it would look at the grandparents, and keep going back until it ran out of ancestor prototypes to search or it found an answer.'use strict1';
id
of where you want your object to appear:
seattleList
so:let seattleList = document.getElementId('seattleList`);
Declare an array of the hours since this is determines the hours we will generate customer data for:
let hour = ['6am', ..., '7pm'];
Declare the Seattle store object:
``` js let seattle = { name: ‘Seattle’, min: 23, max: 65, avg: 6.3, dailyTotal: 0, cookiesSoldEachHour: [], getRandomCustomers: function() { return Math.floor(Math.random() * (this.max - this.min + 1) + this.min); // Rounds down random number. Constructed to be inclusive of max & min } let listItemSeattle: document.createElement(‘li’), // We want the Seattle times & cookies per hour to be posted as list elements on the webpage }
function Constructor(parameter1, parameter2, ...parameterNth) {
this.parameter1 = parameter1;
this.parameter2 = parameter2;
this.parameterNth = parameterNth;
}