HTML
- Enter your HTML notes here
- The head element contains information about the webpage.
- The head element is a container for metadata. The user wont see information in the head or meta elements.
- The meta elements contain information about the page that is used by the browser. The user wont see information in the head or meta elements.
- The body element represents the visible content shown to the user.
- The li element represents a new bullet point in our list.
- The section element are semantic elements that define a section in a document that contains thematic content.
CSS
- Enter your CSS notes here
- 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.
- A color can be picked by semantic references such as gray or blue but can also be refered by its hex code (hex #(type code here)
- Class attributes allow us to share a CSS rule to any element we choose by assigning the rule to a class attribute with a class selector.
- If a "class selector" is called ex. ".card" we can use the code inside this class for multiple "section" elements in our Html code.
- Inline CSS: Inline styles apply to a specific HTML tag, using a "style" attribute with a CSS rule to style a particular page element only.
- Internal style sheet: This internal style sheet contains CSS rules for the webpage in the head section of the HTML file.
- External CSS style sheet: is preferred in most cases because it allows developers to keep all their CSS rules in a separate file, which makes design changes easier.
Git
- Enter your Git notes here
- git status: checks what branch we are currently on
- git checkout -b branch-name: creates a new branch and switches to it
- git checkout main: this command allows you to switch to the main branch
- git add -a: use this command to save all changes you make in your code in VS
- git commit -m: use this command to commit after staging files and add a message within ".." with the commit message ex. "fixed bug in html main file header"
- git pull origin main: pulls the source code from github to ensure that we have the latest commits and changes. Terminal should say "already/branch is up to date."
- gitbash: to create a new file in for example assets folder, type: touch 'script.js', or touch 'name of file'
JavaScript
- Enter your Javascript notes here
- A variable is a named container that allows us to store data in our code.
- Control flow is the order in which a computer executes code in a script.
- Comments: /*Everything in between is a comment.*/ or we can use // if the comment is on the same line.
- Boolean: This is a True/False value. The words true and false are special keywords that don't need quote marks. Example: let myVariable = true;
- Assignmen: As you've seen already: this "=" assigns a value to a variable.
- Strict equality: This '===' performs a test to see if two values are equal. It returns a true/false (Boolean) result.
- What exactly do we mean by “truthy” and “falsy” in Javascript? A value is considered falsy if it is one of the following values: 0, -0, On, "", null, undefined, NaN, or a Boolean data type with the value of false. All other values, including a Boolean with the value of true, are considered truthy.
- An array: is a single variable that is used to hold a group of data. Example: var shapes = ["triangle", "square", "pentagon", "circle"];
- A single array can store different types of data, such as strings, numbers, and so on. Example: var studentInfo = ["Lu", 54, true];
- Arrays are zero-indexed and sequential. This means that the first item in any array has an index of 0, not 1. Example: ["triangle", "square", "pentagon", "circle"] = 0, 1, 2, 3...,
- In order to see one of the data in the array we have to type in console.log(shapes[0]); ( we would then see the triangle) (var shapes = ["triangle", "square", "pentagon", "circle"];)
- for loop: A for loop uses the predictable pattern of indices to perform a task on all the items in an array by allowing a single code block to be executed over and over.
- Example of a for loop: for(var x = 0; x < shapes.length; x++)
- While writing a for loop. Think of length = the length of the array topics 0,1,2,3.. so the length will be 4.
- A function is different from a for loop or conditional statement because functions do not automatically execute when the JavaScript file (in our case, script.js) is run. Example of function: function selectTopic()
- Function: functions needs to be called (call a function). Example: function listTopics(). To call it you type: 'listTopics()' under the function code.