HTML Text, CSS Introduction, and Basic JavaScript Instructions
This section summarizes material covered in Duckett HTML & CSS
HTML Text
- HTML elements are used to describe the structure of the page
- HTML elements provide semantic info (where emphasis should be placed, quotations)
Introducing CSS
- CSS treats each HTML element as if it appears inside its own box and uses rules to indicatie how the element should look
- Rules are made up selectors and declarations
- Selectors specify the elements the rule applies to
- Declarations indicate what these elements should look like
- Declarations are made up of two parts: properties of the element that you want to change, and the values of those properties
- CSS rules usually appear in a separate document
JavaScript
and Duckett JavaScript books
Basic JavaScript Instructions
- A script is made up of a series of statements
- Variables are used to temporarily store pieces of info used in the script
- Arrays are special types of variables that store more than one piece of related info
- JavaScript distinguishes between numbers (0-9), strings (text), and Boolean Values (true or false)
- Expressions evaluate into a single value
- Expressions rely on operators to calculate a value
Decisions and Loops
- Conditional statements allow your code to make decisions about what to do next
- comparison operators are used to compare two operands
- Logical operators allow you to combine more than one set of comparision operators
- if…else statements allow you to run one set of code if a condition is true, and if another if it is false
- switch statements allow you to compare a value against possible outcomes (or default option)
- data types can be coerced from one type to another
- All values evaluate to either truthy or falsy
- break causes the termination of the loop and tells the interpreter to go onto the next statement of code outside of the loop
- continue tells the interpreter to continue with the current iteration, and then check the condition again. If it’s true, the code runs again
- for loop — the condition is usually a counter which is used to tell how many times the loop should run (if you need to run code a specific number of times)
- while loop — the condition can be something other than a counter, and the code will continue to loop for as long as the condition is true (if you do not know how many times the code should run)
- do while loop always runs the statements inside the curly braces at least once, even if the condition evaluates to false