#
Arrays Operators and Expressions Conditionals Loops
when things dont need to be done in a certain order
by selecting a different style using css ul list-style-type
if you want things to be done in order use and ordered list, eg baking a cake recipe (ordered) list of ingredants (unordered)
- give them the attribute reversed to reverse the order of numbers
- give them an integar to start the ‘count’ by assigning attribute start.
margin is someone who during the box model story gathers everyone together guids them to where they should be padding is someone who during the box model story who likes to fill in gaps and creates space for the main character Content to stand out
- Content box: area where your content is displayed. the ‘centre’
- Padding box: sitting around the outside of your content as white space
- Border box: wraps the content and padding (if any)
- Margin box: the outermost layer wrapping everything listed above
strings, numbers, objects and other arrays!
const people = [[‘pete’, 32, ‘librarian’, null], [‘Smith’, 40, ‘accountant’, ‘fishing:hiking:rock_climbing’], [‘bill’, null, ‘artist’, null]]; Yes you can have different data types in an array. You can access the value by typing ‘console.log(people[2]);
- = assign the value
- += adds the values together
- -= subtracts from eachother
- /= divids them
- «= left shifs the assignment
let a = 10; let b = ‘dog’; let c = false;
// evaluate this (a + c) + b;
This area always confuses me and will need to spend more time on!
- Describe a real world example of when a conditional statement should be used in a JavaScript program. Conditional statements control behavior in JavaScript and determine whether or not pieces of code can run. There are multiple different types of conditionals in JavaScript including: “If” statements: where if a condition is true it is used to specify execution for a block of code.
A suggestion is during a confirmation model. If something should only run when someone wants to proceed then using a conditional statment is a good start.- Give an example of when a Loop is useful in JavaScript. Loops are all about doing the same thing over and over again. Often, the code will be slightly different each time round the loop, or the same code will run but with different variables. Like if your waiting for a state to change before you can proceed with the next stage of code.