- Fork this repo
- Clone your fork
- Fill in your answers by writing in the appropriate area, or placing an 'x' in the square brackets (for multiple-choice questions).
- Add/Commit/Push your changes to Github.
- Open a pull request.
Describe the purpose of a clearfix in CSS, and give an example of how to do it.
Your Answer:
.clearfix {
overflow: auto;
}
/// <div class="clearfix"> in the html
What does the following selector do? ul.dropdown > li
?
Select 1:
[x] Selects all li's which are directly inside a ul of class dropdown (children)
[] Selects all li's which are anywhere inside a ul of class dropdown (any descendant)
[] Selects all ul's of class dropdown, as well as the children elements that are li's
[] Selects all ul's of class dropdown, only if their children are exclusively li's
Describe the rules of scope in JavaScript.
Your Answer: ``In JavaScript, scope is the set of variables, objects, and functions you have access to. There's local scope and global scope; local scope refers to the context in which variables objects and functions are used within a function. This is implemented by 'this' and 'bind'. Global scope refers to the use of objects variables and functions within the entire script (out side of the functions).
I think.
### Question #4
Define an object and store it in a variable `pizza`. The object should have 2
properties: a temperature (set to 70), and a method called `bake`. When called,
this method should set the pizza's temperature to be 300. Note: you may not use
the variable pizza inside your method.
Your Answer:
var pizza = { var temperature = 70; var bake = function() { temperature = 300; } }
## Callbacks
### Question #5
**Define a function called `doSomething`. It should take one argument, called
`thingToDo`. When called, `doSomething` should invoke the function given as an
argument. Finally, demonstrate calling `doSomething` with a function.**
Your Answer:
```var doSomething = function(thingToDo) {
thingToDo();
}
var greeting = function () {
console.log("HI!");
}
var bye = function () {
console.log("laterr");
}
doSomething(greeting);
doSomething(bye);
What is the difference between synchronous and asynchronous program execution?
Select all that apply:
[] Synchronous code runs at an even pace, asynchronous code runs with uneven pacing.
[] Synchronous code runs all at the same time, asynchronous code runs completely randomly
[] Synchronous code runs in order (as appears in the source), asynchronous code may run at a later time.
Which of the following represents a correct workflow for submitting a PR on a non-master branch? (ignore the lack of commit messages)
Select 1:
[x] fork on github; git clone <fork_url>; git checkout -b <charlie_solution>; git add <files>; git commit; git push; create pull request
[] fork on github; git clone <ga_dc_url>; git checkout -b <charlie_solution>; git add <files>; git commit; git push; create pull request
[] git clone <ga_dc_url>; git branch <charlie_solution>; git add <files>; git commit; git push; create pull request
[] fork on github; git clone <fork_url>; git checkout -b <charlie_solution>; git add <files>; git commit; git pull; create pull request
Which of the following statements will work, assuming jQuery is loaded?
Select all that apply:
[x] `$(".post").css("background", "peachpuff")`
[] `$(".post").innerHTML`
[x] `$(".post").html()`
[x] `document.getElementsByClassName("post")[0].innerHTML`
[] `document.getElementsByClassName("post").innerHTML`
Using jQuery, add an event listener for clicks on the button with the id 'greeting'. When the event happens, the code should append a paragraph to the body, that says "hello".
Your Answer:
// your code here
Create a repo for project 1. (You don't need to fork, just create a brand new repo).
Create a readme.md in that repo. In the readme, write out five (5) user stories for your first project. Be sure to include a role, goal, and reason for each.
Finally, link to your repo on github in the space below.
Your Answer: