web development Flashcards
when creating an app or functionality for a webpage, should you use spaghetti code?
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.
what is hardcoding?
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.
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?
no, a function can have 20 parameters but in a particular instance you only use one or two of them
what does the array method .join( ) do?
it takes the items in an array and turns them into a string
what does cuid( ) do? and how is it used?
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 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?
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
what does the em tag do?
puts the text inside of it in italics
what does the s tag do?
it puts a straight line through the text in between the tags
what does the u tag do ?
it underlines the text that goes inside of the tags
what does the strong tag do?
it buts the content in between the tags in bold
what does the br tag do?
it creates a line break
how do you make the strikethrough effect in css?
text-decoration: strikethrough;
what does an hr tag do?
it creates a horizontal line along the length of an html document
does the hr tag have an closing tag
no it doesnt take one
what does box-shadow do?
it adds a shadow to the element selected.
what values does box-shadow take?
offset-x, offset-y, blur-radius, color
in that order
what does text-shadow do?
it creates shadow on text
how does the opacity work in css?
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.
can you set the opacity for any colored element and if so how?
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
what does text-transform do?
changes the text in various ways
what are the values of text transform and what do they do?
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
what does line-height do?
it changes the amount of vertical space that each line of text gets.
what is a template string?
${variable name}
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?
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