What command would you use to clone a remote repository? →
# clone a remote repo
git clone https://github.com/your_username/your-repository-name.git
What is the command to show a remote repo? →
# show remote repositories
git remote -v
# The output should look something like...
# origin https://github.com/bzuckerman/lab-10-prep.git (fetch)
# origin https://github.com/bzuckerman/lab-10-prep.git (push)
...continued...
What command would you use to configure your cloned repository with your name and email? →
# configure it with your name and email
git config user.name "your name"
git config user.email "your@email.address"
What’s are the commands that you would use for making, saving and sharing changes? →
# (make changes)
# show the exact, line-by-line changes that you've made
git diff --color
# check on the status of your changes
git status
# stage your changes / prep them to be saved
git add --all
# check your staged changes using git status again
git status
# (continued...)
Saving and sending to the remote repository →
# save them, make sure you remember your comment by using -m!
git commit -m 'my message'
# show a history of your changes
git log --color (show your changes so far)
# send to your remote repository
git push origin master
What’s a function? What’s a function call? What are arguments? →
How do you call or execute a function? →
prompt("hello") is a function call
JavaScript comes with many built-in functions. We know four; what are they and what do they do? →
What type of value does prompt always return? What type of value does parseInt always return? →
Remember that the function prompt gives back a value. To retain that value, you have to hold it in a variable:
var answer = prompt("Yes or no!?");
Curly braces denote statements of code that are grouped together. Everything within the curly braces below is considered part of the if statement. Blocks of code must start and end with curly braces…
... {
// code wrapped by curly braces
}
What kind of statement would we use to execute code if a condition is true? →
An if statement…
if (some_boolean_expression) {
// do stuff here if expression is true
}
What kind of statement would we use to execute code one branch of code if a condition is true and another branch of code otherwise? →
if (some_boolean_expression) {
// do stuff here if expression is true
} else {
// do stuff here if expression is false
}
What kind of statement would we use to execute multiple branches of code based on multiple chained conditions? →
Use if / else if statements
if (boolean_expression_1) {
// do stuff here if expression 1 is true
} else if (boolean_expression_2) {
// do stuff here if expression 2 is true
} else if (boolean_expression_3) {
// do stuff here if expression 3 is true
}
What construct do we use if we want to execute a block of code multiple times without writing it multiple times? →
A for loop consists of the keyword, for, and three parts, separated by a semicolon, contained within parentheses:
You can use the variable that you declare in the initialization within your for loop!
// initialization
// | condition
// | | afterthought/increment
// | | |
for(var i = 0; i <= 5; i = i + 1) {
console.log(i);
}
Create a for loop that prints out the square of every number from 1 through 10 →
for(var i = 1; i <= 10; i = i + 1) {
console.log(i * i);
}