Prework Study Guide
✨ Open the Console to See What's Happening ✨
HTML
- The head element contains information about the webpage
- Elements in the <head> are not visible to user, except for attribute:Title which is shown in the tab
- The body element represents the visible content shown to the user
- HTML is case-sensitive other than declarations
- <!-- comment -->
CSS
- Three types: Inline CSS, Internal CSS Style Sheet, External CSS Style Sheet
- Most commonly used will be External CSS Style Sheet. Allows devs to keep all their CSS rules in a separate
file, making design changes easier
- Will need to link the file using <link> element placed in the HTML's head. Eg: <head> <link
rel="stylesheet" href="./location/file.css"/> <head>
- Margin indicates how much space we want around the outside of an element.
- Padding indicates how much space we want around the content inside an element.
- Selector -defines element or attribute to which rules/declarations will apply
- CSS Box Model:
- Declarations -have two components: CSS property we want to apply, and the value of the
property
- Class attributes can be assigned to chosen elements in the HTML to assign CSS rules to
eg: .card "."designates a class selector; "card"is the class. Any HTML element
assigned to "class" will gain the property assignments from CSS
- /* comment */
Git
- git status: checks what branch we are currently on
- git checkout (): switch to another branch
- git status
- git checkout -b branch-name: creates a new branch and switches to it
- git add -A: adds all modifications in current working branch to staging area
- git commit -m "comment": commits to repository, '-m' -associates message with our commit
- git pull origin main: pull base branch into feature before pushing up code (*important to make sure you have
the latest version of project)
- git push origin branch-name: pushes changes from local environment into GitHub
- in GitHub repo, click "Compare & pull request"
- click "Create pull request"
- click "Merge pull request"; click "Confirm merge"
JavaScript
- Ctrl+Shift+I (windows), Command+Option+I (mac), Left-click>Inspect -to access Chrome DevTools
- A "variable" is a named container that allows us to store data in our code
- Control Flow -order computer executes code. In JavaScript, runs from top down. can use conditional
statements and loops to control order code is executed/if at all
- If statement -will only execute if statement meets a condition/is true
Falsy: 0, -0, On, "", null, undefined, NaN, boolean:False
Truthy: all other values, boolean:True
- "else if"; "else"
- Array -single variable holding group of data. Can store different types of data(string, numbers, etc).
identified by zero-indexed and sequential index numbers (first data at 0)
- For Loop -uses predictable pattern of indices to perform a task on all the items in an array by allowing a
sinlge code block to be executed repeatedly (must use another statement to interrupt the control flow)
- For loops need 3 statements to: determine starting point; condition; allow iteration over each item
eg. for (var x = 0; x < array.length; x++) { code block }
- A "function" is a set of instructions that tells the computer how to perform a certain task.
Functions do not execute automatically; must be called to execute(can be reused).
- First, declare a function and set its code. Then, call the function to execute it.
- // comment if no line-breaks
- /* comment */