Prework Study Guide
✨ Open the Console to See What's Happening ✨
HTML
- The head element contains information about the webpage.
- The body element represenets the visible content shown to the user.
- li = list item
- ul = unordered list
- ol = ordered list
- h1 - 6 tell the computer what size of header the text is
- The "section" element is how you separate different elements. See "parent/child elements".
- Parent elements are the larger elements that contain the child elements eg. section = parent, h2 = child.
CSS
- A margin indicates how much space we want around the outside of an element.
- A padding indicates how much space we want around the content inside an element.
- For your CSS code to affect your project, you need to link it to your other files.
- A class selector allows you to give property assigments to only some elements instead of all of them.
- Here's some examples of properties you can change: text-allign, padding-left/right/top/bottom, margin, width, height, color, background-color, font-size, border, etc.
Git
- git status: checks what branch we are currently on.
- git checkout -b branch-name: creates a new branch and switches to it.
- The git flow is the order you perform the steps of uploading your work to github.
- The git flow goes like this...
- In the terminal, make sure you are in the correct directory and branch, and run the command 'git add -A' to stage your changes
- Add a commit message that describes the changes made to the code using the command 'git commit -m "your message here"'
- Make sure your local branch is up to date by running 'git pull origin main'
- Push up your changes to the remote repo by running 'git push origin (your current feature branch)'
Javascript
- A variable is a named container that allows us to store data in your code.
- Control flow is the order in which a computer executes code in a script.
- The control flow affects how your code needs to be written. In order to use a variable in a function or otherwise, the variable needs to be defined first. Order matters!
- An array is a single variable used to hold a group of data.
- You can access the data inside an array by using the index value of the item we want.
- A for loop allows you to repeat a single block of code over and over on each item in an array.
- For loop structure = Starting point; Condition; Final statement.
- Starting point: The first index of an array is always 0, so we declare a variable x and assign it a value of zero.
- Condition: Using the length propery we can express that we want the loop to continue as long as the variable x is less than the length of the array.
- Final Statement: This is what we are telling the loop to do each time. We can use x++ to increase the number by 1 each time the loop repeats.
- eg. for(var x = 0; x < shapes.length; x++) { // code block}
- Functions need to be followed by parenthases ()