These are my reading notes for Code Fellows
<h1>
through <h6>
you can create headings and subheadings like you would in Microsoft Word<p>
and corresponding closing tags like </p>
<!DOCTYPE html>
<!-- comment here -->
<p id="id name">
<p class="class name">
According to Roger Huba from Code 102, <div>
and <span>
elements are antiquated, but we should still know them in case we come across them from an older website
You can add <meta>
info on your page for Search Engine Optimization (SEO) purposes. Examples include keywords, descriptions, and page authors
&
HTML5 elements provide clearer code than their <div> cousins
Headers and footers sit inside their respective elements
Sidebars sit inside an <aside> element
Content below header can sit inside a <section> element
x | - | Home | - | - |
---|---|---|---|---|
About | Articles | Visit | Shop | Contact |
History | News | Location | Merch | - |
Team | News | Hours | Art | - |
NOTE: These notes are taken from my Code 102 course notes. I am the author of the notes, but please be aware that certain text in block quotes is taken from Jon Duckett’s JavaScript & JQuery Book
JavaScript allows you to make web pages more interactive by accessing and modifying the content and markup used in a web page while it is being viewed in a browser
- Jon Duckett - JavaScript & JQuery
JavaScript essentially allows us to give step-by-step instructions to a browser/computer, kind of like a recipe
Allows users to interact with elements of your website, and allows your website to change depending on certain events/conditions
Common versions of JavaScript that you’ll see on websites:
All of the above rely on the ability to:
Access the content of a page
Modify the content of a page
Program rules or instructions the browser can follow
React to events triggered by the user or browser
Even if scripts might appear complicated to you now, they’re actually a simple set of instructions
Individual steps of a recipe might need to be broken down further. For example, when making spring rolls, “create peanut sauce” might have its own sub-instructions. Computers need this information
Vocabulary: The words that computers understand
Syntax How you put those words together to create instructions computers can follow
Use flowcharts for the tasks you want the computer to achieve!
<html>
is the content layer
{css}
is the presentation layer
javascript()
is the behavior layer
All three of these layers work together to make a modern functioning website
Keeping things separate means that pages will still work if certain layers don’t load/run
JavaScript allows you to add many features onto your webpage that change depending on a number of variables. This can range from what name someone enters into a form, the current time of day, or the changing cost of a good (among many others)
JavaScript is case sensitive
Calling
document.write('good afternoon');
document
= the web page.
= member operatorwrite
= adds new text/content to your page('good afternoon')
= parametersJavaScript runs wherever <script>
is added in your HTML code
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;