Semantic HTML adds readability to your HTML tags. There aren't strict rules around
Basic Overviewsection
A section
declares a basic grouping of similar content.
article
Use of the article
tag represents a block of content that can be read independently from the rest of
the site.
aside
Aside
contains content related to the surrounding content.
header
The header
element identifies basic information about the following content.
footer
or another header
footer
The footer
element identifies basic information about the following content.
article
author informationarticle
related documentsnav
The nav
element is used to define a list of major navigation links.
article
JavaScript is a client side programming language that is executed by the browser. It can be used to build interactive web pages that respond to user input.
You add JavaScript in a similar way that you add CSS to your page.
script
tag
script
file
<script src="script/main.js"></script>
How JavaScript is properly formatted.
Each block of JavaScript needs to be separated by a semi colon.
You can use the following methods to easily output information onto the screen.
<script>
//Writes to just below the body tag.
document.write('Hello World');
//Displays a popup message
alert('message');
//Displays to your dev tool's console
console.log('Hello World');
</script>
JavaScript variables are used to store information for later use.
You declared a variable by using the var
keyword.
var foo;
var bar;
You can assign a value to a variable when it has been declared
var foo = "Hello World";
Variables can be used before they are declared. It makes the code harder to follow.
var
keyword$
and _
_
on multi word variables.It's important to give your variables a name that is descriptive of it's purpose.
var foo = "Hello World"; //What the heck is a foo?
var message = "Hello World"; //A message of some sort
var timeofday = "9:00pm"; //Can be hard to read
var timeOfDay = "jon.middaugh"; //A little bit easier to read
var user_name = "jon.middaugh"; //underscore example
var $foo = "Hello World"; //Valid
var pixels80 = "80px"; //Valid
var 80px = "80px"; //Invalid
var _name = "Jon"; //Valid
var message = "Hello World";
console.log(message);
A boolean variable represents a true
or false
value
var isBlack = true;
var isBlue = false;
Booleans are incredibly simple, but we use them all over the place in code.
Numeric values in JavaScript can be represented in integer or float values.
var ten = 10;
var pi = 3.14159265359;
String variables are composed of text inside single or double quotes
var myName = "Jon Middaugh" //Using Double Quotes;
var yourName = 'John Doe'; //Using single quotes
var foo = 'You'll be there tomorrow'; //Invalid
var bar = 'You cannot do this"; //Invalid
What if I need to use an apostrophe or quote in my string?
var phrase = "I said \"Hello!\"";
var phrase2 = 'I\'m the best fit';
Using what we've learned, recreate the website located here
Use Chrome's developer tools to get the information you need to recreate. Try to minimize your work by reusing classes and properties.
Comments in JavaScript