Reading Notes
Structural Markup used to describe headings and paragraphs Semantic Markup provides extra information and emphasis on certain parts of a sentence or paragraph
Text Emphasis, Line Breaks, and Horizontal Rules
<b></b>
Bolds text<i></i>
italic<sup></sup>
Superscript<sub></sub>
Subscript<br />
Creates a line break in the text<hr />
Creates a horizontal ruleWhite space condensing multiple spaces in a row are condensed to a single space, multiple blank rows are condensed to a single blank row
Semantic Tags
<strong></strong>
Emphasis on text between the tags, browser will default to bold<em></em>
Emphasis that subtly changes the meaning of a sentence, browser defaults to italics<blockquote></blockquote>
Used for quotes that take up more than one line, browsers will likely indent text by default<q></q>
Inline quote, browser should add in quotes, but not all do<abbr></abbr>
Abbreviation tag shows full description of a short form
<abbr title="National Aeronautics and Space Administration">NASA</abbr>
<cite></cite>
Citation used to indicate where a citation if from, will render in italics<dfn></dfn>
Definition, used when first explaining new terminology<address></address>
Contains the contact information for the author of the page<ins></ins>
Used to show content that was inserted into a page<del></del>
Used to show content that was deleted from a page<s></s>
Element that indicates something that is no longer accurate or relevant but should not be deleted, shown as strikethrough textCSS allows the programmer to create rules that determine how each element box is presented
p{font-family: Arial;}
p
selector, in this case indicating all <p>
tags{font-family: Arial;}
declaration, setting text font to arialfont-family:
property, indicates the aspect of the element to be controlledarial;
value, specific setting to be usedTo link style.css doc to index.html, use similar code in the html doc:
<head>
<link href="css/example.css" type="text/css" rel="stylesheet" />
</html>
To control styles in an html doc, use <style></style>
tags
<style type="text/css">
body{
font-family: arial;
background-color: rgb(255,255,255);
}
</style>
Full chart of css selectors can be found on page 238
CSS Rule Cascade
!important
can add the !important
after any property value to force it to take precedence
p{color: blue !important;}
Statement each individual step that the computer is intended to follow, ends with a ;
Comments programmer side notes that are used to convey code intent for easier debugging and future updating
cmd+/
to automatically comment a lineVariable a data storage unit
var quantity;
declaring the variable named quantityquantity = 3;
assigning the value 3
to the variable quantity
Data Types
Numeric Data Types | String Data Types | Boolean Data Types |
---|---|---|
Example = 0.75 |
Example = 'Hi, Ivy!' |
Example = true |
For tasks involving counting or sums | Enclosed in a pair of single or double quotes used for working with text | True / False |
Strings must always be surrounded by quotes either "string"
or 'string'
but not a combination. It must also be on one line.
6 Rules for naming variables
$
, or underscore _
-
, or dots .
are allowed in a nameArray a variable that stores a list of values
[]
and comma separated items
var colors = ['white', 'black', 'custom'];
this format is known as an array literal, this is the preferred methodvar colors = new Array('white', 'black', 'custom');
this format is know as an array conductor0
not 1
0
is 'white'
, 1
is 'black'
, and 2
is 'custom'
arrayName[index number]
var itemThree = colors[2]
sets variable itemThree
to 'custom'
arrayName.length;
var numColors = colors.length;
arrayName[index number] = 'new value';
colors[2] = 'beige';
changes the third array item from 'custom'
to 'beige'
Expressions evaluate into a single value
var color = 'beige';
The value of color is now beigevar area = 3 * 2
The value of area is now 6Operators allow programmers to create a single value from one or more values
var color = 'beige';
The value of color is now beigearea = 3 * 2
The value of area is now 6greeting = 'Hi ' + 'Molly';
buy = 3 > 5;
Value of buy is now falsebuy = (5>3) && (2<4);
The value of buy is now trueArithmetic Operators JS contains the standard operators +, -, /, *
which can be used with numbers as well as the following special operators
++
(Increment) adds one to the current number--
(Decrement) subtracts one from the current number%
(Modulus) divides two values and returns the remainder example: 10 % 3 = 1
String Operator just one operator +
used to join strings on either side
Mixing numbers and strings
#
) create a string, not a numeric number type. Arithmetic operators cannot be used on strings
'2' + '2' = '22'
Adding strings concatenates them, it does not add.12 + 'Bob' = '12Bob'
Adding a number to a string, creates a new concatenated string'seven' * 'nine' = NaN
(Not a Number) attempting to use arithmetic operators on strings will return a value called NaNComparison operators can compare one value in the script to its expected value and result boolean
==
Is Equal To compares two values (numbers, strings, or booleans) to see if they are the same
'ABC' == 'DEF'
returns false
'ABC' == 'ABC'
returns true
!=
Is Not Equal To compares two values to see if they are not equal
'abc' != 'def'
returns true
'abc' != 'abc'
returns false
===
Strict Equal To compares two values to see if both their value and data type are the same
'3' === 3
returns false
not same data type'3' === '3'
returns true
!==
Strict Not Equal To compares two value to confirm that both the data type and value are not the same
'3' !== 3
returns true
not the same data type or value'3' !== '3'
returns false
same data type and value>
Greater Than checks to see if the number on the left is greater than the one on the right
4 > 3
returns true
3 > 4
returns false
<
Less Than checks to see if the number on the left is less than the one on the right
4 < 3
returns false
3 < 4
returns true
>=
Greater Than or Equal TO checks if the number on the left is greater than or equal to the number on the right
4 >= 3
returns true
3 >= 4
returns false
3 >= 3
returns true
<=
Less Than or Equal TO checks if the number on the left is less than or equal to the number on the right
4 <= 3
returns false
3 <= 4
returns true
3 <= 3
returns true
Logical Operators
&&
Logical And tests more than one condition
((5 < 2) && (2 >= 3))
returns false
||
Logical Or tests for at least one condition being true
((5 < 2) || (2 >= 3))
returns false
((5 < 2) && (2 <= 3))
returns true
!
Logical Not inverts a single boolean value
!(2 < 1)
returns true
Short Circuit Evaluation logical evaluations evaluate from left to right and will stop as soon as they are satisfied of the result
false && anything
returns false
without evaluating anything
because both values cannot be truetrue || anything
returns true
without evaluating anything
at least one of the values is trueIf Statement runs the code in the code block if the if statement is true
If Else Statement runs the code in the if code block if true
otherwise runs code in the else block
if(score >= 50) {
congratulate();
} else {
encourage();
}
Commit messages should have a plan to incorporate the following characteristics
Correct commit subject lines will work in the following format