Skip to content

Latest commit

 

History

History
63 lines (36 loc) · 3.46 KB

class-03.md

File metadata and controls

63 lines (36 loc) · 3.46 KB

HTML

When should you use an unordered list in your HTML document?

Use ul in HTML for lists of items without a specific order, like navigation menus or bullet-point lists. It adds semantic meaning for accessibility and styling control with CSS.

How do you change the bullet style of unordered list items?

You can change the bullet style of unordered list items in CSS using the list-style-type property. Set it to values like disc, circle, square, or even none to remove bullets altogether.

When should you use an ordered list vs an unorder list in your HTML document?

Use an ordered list ol when presenting items in a specific sequence like steps or rankings. Use an unordered list ul when the order of items isn't significant like lists of options or bullet-pointed information.

Describe two ways you can change the numbers on list items provided by an ordered list?

By using the start attribute on the ol element to specify a starting number for the list. For example, ol start="3", will start numbering the list items from 3 instead of 1. Or by using the list-style-type property with values like decimal, lower-roman, or upper-alpha.

CSS

Describe the CSS properties of margin and padding as characters in a story. What is their role in a story titled: “The Box Model”?

In "The Box Model," margin provides space between elements, while padding safeguards content within element borders, making webpages look clean and organized.

List and describe the four parts of an HTML elements box as referred to by the box model.

  • Content: The text of the HTML element.
  • Padding: Space between the content and the border.
  • Border: The line or boundary around the padding and content.
  • Margin: Space outside the border, separating it from other elements.

JS

What data types can you store inside of an Array?

Arrays store elements of a single data type including integers, floating-point numbers, characters, strings, booleans, custom objects or structures, pointers or references, and other arrays.

Is the people array a valid JavaScript array? If so, how can I access the values stored? If not, why?

Yes, to access the values stored in the array you can use square brackets [] to specify the index of the element you want to access. console.log(people[1]); The result will be Smith, 40, accountant, fishing:hiking:rock_climbing

List five shorthand operators for assignment in javascript and describe what they do.

  • +=: Adds the value on the right to the variable on the left.
  • -=: Subtracts the value on the right from the variable on the left.
  • *=: Multiplies the variable on the left by the value on the right.
  • /=: Divides the variable on the left by the value on the right.
  • %=: Calculates the remainder of dividing the variable on the left by the value on the right.

Read the code below and evaluate the last expression and explain what the result would be and why.

It is 10dog because false is equal to 0.

Describe a real world example of when a conditional statement should be used in a JavaScript program.

In a shopping website a conditional statement is crucial for applying discounts based on the total purchase amount. If the total exceeds a certain threshold a discount could be applied.

Give an example of when a Loop is useful in JavaScript.

A loop in JavaScript is useful for cycling through elements in an array allowing tasks like calculating the total score of exam grades efficiently.

Things I want to know more about