Prework Study Guide
✨ Open the Console to See What's Happening ✨
HTML
- HTML consists of elements which each have different functions.
- Nested elements are known as child elements, with the element containing child elements known as the parent element.
- Elements contain opening and closing tags.
- It's good to use semantic elements, those whose name describes its function, to make your code easier to read.
CSS
- You can style a webpage using CSS in 3 ways: inline, internal, and external.
- Inline CSS is applied directly to a single element.
- Internal style sheets are where you embed an entire style sheet inside the HTML file. Those rules apply to a that specific page.
- External style sheets are used to style a whole website and keep the code separate based on use. It must be linked in the HTML file.
- A CSS rule comprises: a selector, properties and values. The rule can be applied to all elements, or a class of elements.
- The properties and their respective values are known as declarations, together they make up the declaration block.
- Margin is a property that adds space around the outside of an element.
- Padding is a property that adds space around the inside of an element. Increasing the padding increases the overall size of the element.
- If you want to apply properties to all elements on the page, use the * selector.
- Where possible, do not repeat yourself (DRY) by using the same bit of code for more than one property. For example, header and footer.
Git
- git status: checks what branch we are currently on.
- git checkout -b branch name: creates a new branch and switches to it.
- git add -A: adds modifications in the current working branch to the staging area.
- git commit -m "[your text here]": commits the specified change, change the text to describe what the commit contains.
- git pull origin main: receive a branch's modifications to the local environment.
- git push origin "[name of branch]": push changes made locally to remote GitHub branch.
JavaScript
- Adds interactivity to a website.
- Is compact and flexible.
- Is case sensitive.
- Variables are containers that store values.
- Declare a variable and give it a value.
- Retrieve the value by calling the variable.
- There are different data types: string, number, Boolean, array, object.
- Variables are needed to allow values to be dynamic.
- Comments in JavaScript are like in CSS. /* Everything in between is a comment.*/ Or use // on one line.
- Operators are mathematical symbols that produce a result based on 2 values or variables.
- Conditionals are code structures used to test if an expression is 'truthy'.
- A common conditional is the if...else statement.
- Functions are a way of packaging functionality you want to reuse.
- You connect the JavaScript file to the index.html file like with CSS. With JavaScript you add it to the body element after the footer.
- Arrays are variables that consist of a list of values, they can have mixed data types.
- For loops uses a predictable pattern to perform a task on all items in the array, by allowing a single block of code to run over and over.