These are my reading notes for Code Fellows
The following need closing tags (</p>
, for example) unless otherwise indicated
Add headings to your page with: <h1>
through <h6>
Add standard ol’ paragraphs to your page with <p>
(alternatively, <article>
)
Bold with <b>
Italicize with <i>
Add superscript with <sup>
Add subscript with <sub>
<br />
<hr />
The following need closing tags (</p>
, for example) unless otherwise indicated
These differ from structural markup because they describe the content vs. just adding style (like italics), although they sometimes add style (like italics) as well
add blockquote with <blockquote>
add shorter quote with <q>
, which apparently just adds quotation marks?
Abbreviate with <abbr>
Cite with <cite>
Define with <dfn>
Add your contact details with <address>
Treat every HTML element like it has an invisible box around it
CSS allows you to change various aspects of those invisible boxes – including making those boxes visible! (with borders)
In the below example, article
is the selector, color: black;
is the declaration
article {color: black;}
color
is the property, black
is the valueExternal links your HTML to an external .css file
Internal styles your HTML directly in the .html file
There are various ways to apply styling to an element of your page. This includes Universal Selectors(* {}
), Class Selectors (.h1 {}
), and ID Selectors (#stylizedh1
).
A script is like a step-by-step instruction of how to tie your shoes (or any other set of instructions). Each step (e.g., “cross each lace”) is a statement.
Statements end with a ;
{
and }
are the start and end of a code block.
Each statement starts on a new line
/* Type comments to yourself using this structure */
// you can use the double forward slash for single-line comments //
Like with HTML and CSS, these will help others understand your code better (and help you when you look back at your code months down the road)
These are just like variables in math or logic, which are “calculated or computed”
Declare a variable like so:
var quantity;
var
is the variable keyword, and quantity
is the variable nameAssign a value to a variable like so:
quantity = 3;
3
is the variable value=
is the “assignment operator,” which tells our code to assign a value to that variable.1.35
'Good Afternoon!'
false
or true
(no other options)You can multiply/add/subtract/etc. variables using just their names, provided you have provided a value (see Data Types) to your variable
There are many ways to de-clutter (or simplify) creating a variable. One option is shown below:
var price = 5;
instead of
var price;
price = 5;
userCity
for the visitor’s location. Make sure to use camelCase!
let familyNames;
familyNames = ['Tim', 'Marisa', 'Willow'];
You can have booleans, strings, and numbers inside this array! Don’t have to be the same type
let itemTwo;
itemTwo = familyNames[1];
let numNames;
numNames = familyNames.length;
Essentially 2 types of expressions:
Depended on by expressions
color = 'red';
red
) to a variable (color
)area = 5 * 10;
50
to the variable area
greeting = 'Yo' + 'Timbo';
Yo
and Timbo
) to create Yo Timbo
+
symbolCheese = 10 > 20;
false
Cheese = (10 > 20) && (2<8>);
Cheese
now becomes true
There are many arithmetic operators that you might recognize from math class, but some are doubled up (like ++
or --
).
Page 76 of Jon Duckett’s JavaScript & JQuery lists some of these operators
only up to the section on switch statements
==
IS EQUAL TO
!=
IS NOT EQUAL TO
===
STRICT EQUAL TO
!==
STRICT NOT EQUAL TO
>
GREATER THAN
<
LESS THAN
>=
GREATER THAN OR EQUAL TO
<=
LESS THAN OR EQUAL TO
The below are Logical Operators:
&&
is a Logical And
true
Tests more than one condition
||
is a Logical Or
true
Tests at least one condition
!
is a Logical Not
true
, it changes it to false
Reverses the state of an expression
A code block will run repeatedly (in a loop) until it returns the condition of false
.
for
runs a code a certain number of times
while
code will continue to run as long as a condition is true
do...while
like while
, with some caveats
i++
or i--
adds or subtracts one, respectively)