Reading Notes
Domain Modeling conceptual model that describes the various entities, attributes, behaviors, and constraints
this
variable can access an object’s properties and methods from insideTables
<table></table>
element used to create a table, contents written out row by row<tr></tr>
table row, used to start each row<td></td>
table data, field cells<th></th>
table heading, top of each column but used just like <td>
<td colspan="2">
cell that spans two columns<td rowspan="2">
row that spans two columns<thead></thead>
Table headings<tbody></tbody>
Table body<tfoot></tfoot>
Table footConstructor Notation
var hotel = new Object();
hotel.nam = 'Quay';
hotel.rooms = 40;
hotel.booked = 25;
hotel.checkAvailability = function () {
return this.rooms - this.booked;
};
new Object();
creates a new objectBrowser Object Model - many methods shown on pg 124
Document Object Model (The DOM)
The Document Object
document.title
Title of the current documentdocument.lastModified
Date of last modificationdocument.URL
Returns string containing URL of current documentdocument.domain
Returns domain of current documentString Objects
var saying = 'Home sweet home ';
saying.length;
16, returns length of stringsaying.toUpperCase();
HOME SWEET HOME, changes string characters to upper casesaying.toLowerCase();
home sweet home, changes string characters to lower casesaying.charAt(12);
o, returns that character at a given index locationsaying.indexOf('ee');
7, returns the first index position of the first time a character or set of characters is found in a stringsaying.lastIndexOf('e');
14, returns index location of last character matching requestsaying.subString(8,14);
et hom, returns characters between two index numbers, first index number included last is notsaying.split(' ');
[‘Home’, ‘sweet’, ‘home’, ‘ ‘], splits teh string each time desired character is foundsaying.trim();
Home sweet home, removes white space from beginning and end of a stringsaying.replace('me','w');
How sweet home, finds first item in string matching first value and replaces with second valueMethods
isNaN()
checks fi the value is not a numbertoFixed(#desired)
rounds to specified number of decimal places (returns a string)toPrecision(#desired)
rounds to total number of places (returns a string)toExponential()
returns string representing number in exponential formatMath.PI
returns pi (3.14…)Math.round()
rounds number to nearest integerMath.sqrt(n)
returns square root of positive numberMath.ceil()
rounds number up to the nearest integerMath.floor()
rounds number down to the nearest integerMath.random()
generates a random number between 0 inclusive and 1 exclusivepp 137 List of date() methods