web development Flashcards

1
Q

when creating an app or functionality for a webpage, should you use spaghetti code?

A

no you should have clearly defined functions for specific narrow objectives and code it that way so its clear what is going on for someone who is just scanning your code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is hardcoding?

A

during building your site or your app sometimes you need to just add a value or a piece of code to see if something is working properly in its implementation. This act of just randomly choosing some code as a value is called hardcoding.

The hardcoded code is always replaced later by the value from a function meant to produce one in its place once implementation goals are reached.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

if a function has more than one parameter do we need to use all the parameters in our code in order for it to function?

A

no, a function can have 20 parameters but in a particular instance you only use one or two of them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what does the array method .join( ) do?

A

it takes the items in an array and turns them into a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what does cuid( ) do? and how is it used?

A

cuid( ) creates a unique id number using an algorithim that is almost mathematically impossible that it will be repeated.

we can set cuid ( ) as a object value for an id key to create a unique id for an object.

let giants = {
city : 'san francisco',
name: 'giants',
titles: 3,
id : cuid( ) }

this whole object will take an id number thats specific to only it, it will be like 25 characters long

then you can use `${giants.id} to call that specific id back

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how can we iterate through an array of objects and apply a specific attribute onto that object depending on whether a particular key value is true or false?

A

return <li class="${objectName.keyName"> ${item.name} </li>

for example :

return <li class="${item.happy"> ${item.name} </li>

this would look into an object and check to see which objects had a value of true for the happy key… any one that did would then have the hidden css declaration box applied to it. then the name of that item would be produced along with the li to add to a ul which would give you a list of every object in an object array that had a value of false for a happy key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does the em tag do?

A

puts the text inside of it in italics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does the s tag do?

A

it puts a straight line through the text in between the tags

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what does the u tag do ?

A

it underlines the text that goes inside of the tags

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what does the strong tag do?

A

it buts the content in between the tags in bold

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what does the br tag do?

A

it creates a line break

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how do you make the strikethrough effect in css?

A

text-decoration: strikethrough;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what does an hr tag do?

A

it creates a horizontal line along the length of an html document

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

does the hr tag have an closing tag

A

no it doesnt take one

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what does box-shadow do?

A

it adds a shadow to the element selected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what values does box-shadow take?

A

offset-x, offset-y, blur-radius, color

in that order

17
Q

what does text-shadow do?

A

it creates shadow on text

18
Q

how does the opacity work in css?

A

A value of 1 is opaque, which isn’t transparent at all.
A value of 0.5 is half see-through.
A value of 0 is completely transparent.

19
Q

can you set the opacity for any colored element and if so how?

A

by using the property opacity

for example
.links {
opacity: 0.7
};

this will make all elements with the class ‘links’ give the opacity of 0.7

20
Q

what does text-transform do?

A

changes the text in various ways

21
Q

what are the values of text transform and what do they do?

A
Value	Result
lowercase	"transform me"
uppercase	"TRANSFORM ME"
capitalize	"Transform Me"
initial	Use the default value
inherit	Use the text-transform value from the parent element
none	Default: Use the original text
22
Q

what does line-height do?

A

it changes the amount of vertical space that each line of text gets.

23
Q

what is a template string?

A

${variable name}

24
Q

what is a good idea to do when creating functions and you want to see if what youve coded so far is working the way you want it to?

A

console.log something to see if your code is good so far

function handleItemCheckClicked() {
  $('.js-shopping-list').on('click', `.js-item-toggle`, event => {
console.log('`handleItemCheckClicked` ran');
  });
}

this will listen for a click event on a particular element and if its working properly will return ‘handleitemcheckclicked ran’

allowing us to go step by step and make sure that its working before we continue on to implement all the other functionality we want to happen once this button is clicked