Skip to content

Instantly share code, notes, and snippets.

@monstaro
Last active July 29, 2019 22:31
Show Gist options
  • Save monstaro/c36e2385be240f96c007204270f491e0 to your computer and use it in GitHub Desktop.
Save monstaro/c36e2385be240f96c007204270f491e0 to your computer and use it in GitHub Desktop.
Mod 0 Capstone

New comment for each day of the capstone

@monstaro
Copy link
Author

monstaro commented Jul 9, 2019

  1. The type attribute controls the behavior of an input element

  2. The select attribute is used to create a dropdown list.

  3. The type attribute should be set to method="post" to send the form data to the server.

  4. The formset element is used to group similar items in a form together in a box.


  1. Border: Separates the edge of the box from another.
    Margin: Size of the gap between two adjacent borders.
    Padding: Space between the border and the inner content of the box.

  2. 1px 4px 5px 10px Would correspond to 1px on top, 4 px on the right side, 5 px on the bottom, and 10px on the left.

  3. Block elements will stack vertically down the page, where inline elements continue horizontally and flow in between surrounding text.

  4. Using fixed positioning will position an element in relation to the browser window instead of the parent element. Usingz-index you can dictate the layer order of the different elements to control what appears on top. This can be used to position a header to always be showing while you scroll through a paragraph underneath.

  5. A fixed layout keeps the dimensions of its elements the same no matter what the screen size is. Liquid layouts have a responsive design and will expand or contract depending on screen size.

@monstaro
Copy link
Author

monstaro commented Jul 19, 2019

  1. An alt attribute provides information about the image if a user cannot see it. This applies especially for search engines and users with screen readers.

  2. An image element is inline if it is within a block level element. It will not start on a new line. An image element is block if it is placed before another block element, such as <p> or <h1>

  3. What are the benefits of jpg or png image file formats? .jpg formats are suited for images with many different colors such as photographs. .png and .gif are better suited for images with few colors that cover larger areas, such as logos. .png photos can also be saved to feature transparency on rounded edges and semi-opaque colors.


Chapter 16
  1. Indicating image size in CSS is important because it helps the webpage load more smoothly. The code typically loads before the images, so specifying image size 'reserves' the space for them on the website so the images won't move all the words around when it loads.

  2. An image sprite is when a website has multiple uses of the same image, which allows for the page to load faster.

@monstaro
Copy link
Author

monstaro commented Jul 29, 2019

To declare a variable, type the keyword var and then whatever variable you are using, for example, quantity
The equals sign is an assignment operator. It assigns a value to the variable, for example, if your variable name and value is a quantity of 3, you could type quantity = 3; and the equals sign assigns the value to the name.

Strings: Strings consist of letters and other characters such as symbols & punctuation. They are enclosed in a pair of single or double quotes, and are usually used to add new content into a page.
Numbers: Probably the most self-explanatory. This data type stores numbers, including positive and negative numbers, as well as fractional numbers/decimals.
Booleans: Booleans return one of two values: true or false. Possibly the most complex of the three data types (at least at first) it can help return results to a user such as color preference of a car or location information.

What are the six rules for naming variables? What are a few JavaScript reserved words that you should avoid using for variable names?

  • The name cannot start with a number. It must begin with a letter, dollar $ign, or under_score.
  • The rest of the name can contain anything listed above, with the addition of numbers as well. Do not use a dash - or a period . in a variable name.
  • Cannot used a reserved word or keyword. There are full lists available for reserved words in JavaScript. An example would be var because it is already a keyword, so you cannot name a variable a keyword that already exists.
  • Variables are case sensitive. Always use consist casing when naming variables, and it is good practice not to create two variables with the same word but different casing.
  • Use a relavent name when naming variables. For example, hairColor eyeColor instead of characteristicA and characteristicB
  • If the variable name is more than one word, you want to keep the first word entirely lowercase, and for every following word, capitalize the first letter. forExampleThis. This is called camelcase. You can also use underscores, but not dashes.

How can an array be useful when dealing with multiple related values? How do you access/change a value in an array?

Arrays are useful when you are creating a list and you don't know how many items it will contain. This way, you don't have to create enough variables for a long list. To access a value in an array, you type array_name[array_value] or put into context, colors[2] using the example from the book. To change that value, simply add an equals sign and new value in quotes. The full statement would look like this: `array_name[array_value] = 'new value'

What is the difference between an expression and a statement?
A statement simply is a line of instructions, like `array_name[array_value] = 'new value'
An expression can either assign a value to a variable, or use multiple variables to return a single variable.
Basically, an expression is meant to return a single value from one or multiple values, but a statement is more like an instruction.

Three types of operators covered in Chapter 2 are assignment, arithmetic and string operators.
Assignment Operators assign a value to a variable, ex. size = 'large'
Arithmetic Operators perform basic math. ex. hoursPerMonth = 40 * 4;
String Operators can combine two strings 'Today is' + 'September 24th';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment