Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joshua Aragon #191

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions day_1/exercises/booleans.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
In the exercises below, write your own code where indicated
to achieve the desired result.
to achieve the desired result.

A few are done for you already.

Expand All @@ -18,7 +18,7 @@ console.log(typeof (1 == 1));
console.log(1 == 2);

// example: log to the console the result of 7 is not equal to 2:
console.log(/*your code here*/);
console.log(7 !== 2);

// example: log to the console the result of "hello" is equal to "Hello":

console.log("hello" == "Hello")
10 changes: 5 additions & 5 deletions day_1/exercises/concatenation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
In the exercises below, write your own code where indicated
to achieve the desired result.
to achieve the desired result.

A few are completed for you, to provide an example.

Expand All @@ -14,8 +14,8 @@ var team = "Chudley Cannons";

console.log("The " + team + " are " + name + "'s favorite Quidditch team");

// What happens if you include other data types when you use concatination? What data type is logged after we run this code?
// ANSWER to question on line 17:
// What happens if you include other data types when you use concatination? What data type is logged after we run this code? All the code is combined, and is output into a string data type.
// ANSWER to question on line 17:

var number = 7;
var creatures = "unicorns";
Expand All @@ -27,7 +27,7 @@ console.log("My zoo has " + number + " " + creatures + "!")
var speedy = "quick red fox";
var slowPoke = "lazy brown dog";

console.log(/*YOUR CODE HERE*/);
console.log("The " + speedy + " jumped over the " + slowPoke);

// Write code that combines the variables below into a string that
// reads "In a predictable result, the tortoise beat the hare!"
Expand All @@ -36,4 +36,4 @@ console.log(/*YOUR CODE HERE*/);
slowPoke = "tortoise";
speedy = "hare";

// YOUR CODE HERE
console.log("In a predictable result, the " + slowPoke + " beat the " + speedy);
10 changes: 5 additions & 5 deletions day_1/exercises/numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ file from your terminal with the command `node day_1/exercises/numbers.js`
console.log(2 + 2);

// log the result of 7 subtracted from 83 console:
console.log(/*YOUR CODE HERE*/);
console.log(7 - 83);

// log the result of 6 multiplied by 53 to the console:
// YOUR CODE HERE
console.log(6 * 53);

// log the result of 20 divided by 4 to console:
// YOUR CODE HERE
console.log(20 / 4);

// log the result of the modulo of 10 into 54:
// YOUR CODE HERE
console.log( 54 % 10);

// log the total number of snacks to the console, using the variables below:
var healthySnackCount = 7;
var junkFoodSnackCount = 4;
// YOUR CODE HERE
console.log(healthySnackCount + junkFoodSnackCount);
6 changes: 3 additions & 3 deletions day_1/exercises/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ file from your terminal with the command `node day_1/exercises/strings.js`
console.log("Alan Turing");

// Write code below to log `Welcome to Turing!` in the console:
console.log(/*YOUR CODE HERE*/);
console.log("Welcome to Turing!");

// Write code below to log `99 bottles of pop on the wall...`:
// YOUR CODE HERE
console.log("99 bottles of pop on the wall...");

//Write code below to log one line from your favorite song or movie:
// YOUR CODE HERE
console.log("Some nights I wish I could go back in life not to change sh*t, just to feel a couple things twice")
10 changes: 5 additions & 5 deletions day_1/exercises/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ console.log(name);
// Write code below to assign the string 'Dobby' to a variable and
// log that variable to the console:
var houseElf = "Dobby";
// YOUR CODE HERE
console.log(houseElf);

// Write code below to save the string 'Harry Potter must not return to Hogwarts!'
// log that variable to the console:
// YOUR CODE HERE

var notReturn = "Harry Potter must not return to Hogwarts!"
console.log(notReturn)
// example: Write code below to add 2 to the variable `students` and
// log the result:
var students = 22;
// YOUR CODE HERE
students = 24;
console.log(students);

// Write the code below to subtract 2 students from the `students` variable and
// log the result:
// YOUR CODE HERE
students = 22;
console.log(students);
10 changes: 10 additions & 0 deletions day_1/questions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
## Day 1 Questions

1. How would you log the string `"Hello World!"` to the console?
var helloWorld = "Hello World!"
console.log(helloWorld);

1. What is the character you would use to indicate comments in a JavaScript file?
// Backslash

1. Explain the difference between an integer and a floating-point number?
Interger is all whole numbers (positive and negative). floating-point numbers are any decimal numbers.

1. In the space below, create a variable `animal` that holds the string `"zebra"`.
var animal = "zebra"

1. How would you log the string `"zebra"` using the variable that you created above?
console.log(animal);

1. What is concatenation? Use concatenation to log a sentence to the console using the variable `animal`.
It is adding things together.
var favoriteAnimal = "My favorite animal is a" + animal;
console.log(favoriteAnimal)
// this will log the string "My favorite animal is a zebra"
7 changes: 7 additions & 0 deletions day_2/arrays_methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The pop() method removes the last element in the array.

The push() method adds new items to the end of the array.

shift() removes the 0th element from the array.

unshift() will add new elements to the beginning of an array.
27 changes: 14 additions & 13 deletions day_2/exercises/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,37 @@ var animals = ["Zebra", "Giraffe", "Elephant"];
console.log(animals);

// Declare a variable that will store an an array of at least 3 foods (strings)
// YOUR CODE HERE
var food = ["Wings", 'Pizza', "Hamburger"];

// example: Write code below that will log the number of elements in array of
// animals from above.
console.log(animals.length);

// Write code below that will log the number of elements in the array of
// foods from above.
// YOUR CODE HERE
console.log(food.length);

// Write code below that will log "Zebra" from the animals array
// YOUR CODE HERE
var firstElement = animals.shift()
console.log(firstElement);

// Write code using bracket notation that will log the first item in the animals array
// YOUR CODE HERE
console.log(animals[0]);

// Write code using bracket notation that will log the last item in the animals array
// YOUR CODE HERE

console.log(animals[animals.length - 1]);
// Write code using bracket notation that will reassign the last item in the animals
// array to "Gorilla"
// YOUR CODE HERE

animals.splice(2, 1, 'Gorilla');
console.log(animals);
// Write code below that will log the last item from the foods array.
// YOUR CODE HERE

console.log(food.pop());
// Write code below that uses a method to add "lion" to the animals array and
// log the changed array to verify "lion" has been added
// YOUR CODE HERE

animals.push("Lion");
console.log(animals);
// Write code below that removes the last item of food from the foods array and
// log the cahnged array to verify that item has been removed
// YOUR CODE HERE
food.pop();

console.log(food);
16 changes: 8 additions & 8 deletions day_2/exercises/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ var fourthVar = 0;
console.log(firstVar > secondVar); // this should return: false

// log the result of the comparison: is firstVar less than secondVar?
console.log(); // this should return: true
console.log(firstVar < secondVar); // this should return: true

// log the result of the comparison: is firstVar equal to thirdVar? (use the == operator)
console.log(); // this should return: true
console.log(firstVar == thirdVar); // this should return: true

/*
Note: this is an example of type coercion. Although thirdVar is a string and secondVar is an integer,
Expand All @@ -25,7 +25,7 @@ perform this evaluation
*/

// log the result of the comparison: is firstVar strictly equal to thirdVar? (use the === operator)
console.log(); // this should return: false
console.log(firstVar === thirdVar); // this should return: false

/*
Note: the strictly equal to operator compares the value of the variable in addition to the type of the variable.
Expand All @@ -34,19 +34,19 @@ the comparison still evaluates to false.
*/

// log the result of the comparison: is firstVar not equal to secondVar?
console.log(); // this should return: true
console.log(firstVar !== secondVar); // this should return: true

// log the result of the comparison: is secondVar greater than or equal to 20?
console.log(); // this should return: true
console.log(secondVar >= 20); // this should return: true

// log the result of the comparison: is secondVar greater than or equal to 21?
console.log(); // this should return: false
console.log(secondVar >= 21); // this should return: false

// log the result of the comparison: is secondVar less than or equal to 20?
console.log(); // this should return: true
console.log(secondVar <= 20); // this should return: true

// log the result of the comparison: is secondVar less than or equal to 21?
console.log(); // this should return: true
console.log(secondVar <= 21); // this should return: true

// log the result of the comparison: is 0 equal to true?
console.log(0 == true) // this should return: false
Expand Down
14 changes: 10 additions & 4 deletions day_2/exercises/iteration.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ for (var i = 0; i < animals.length; i++) {
// <animal> is awesome!" for each animal.

for (var i = 0; i < animals.length; i++) {
// YOUR CODE HERE
console.log("The " + animals[i] +" is awesome!");
}

// Create an array of foods and then iterate over that array to log "Add
// <food> to shopping list" for each food item.
// YOUR CODE HERE

var foods = ["apple", "cheese", "chicken", "blue berries", "watermelon"];
for (var i = 0; i< foods.length; i++) {
console.log("Add " + foods[i] + " to shopping list" )
};
// Create an array of numbers and then iterate over that array to log doubles
// of each of the number.
// YOUR CODE HERE
var numbers =[7, 4, 68, 79, 32, 17];

for(var i = 0; i< numbers.length; i++) {
console.log(numbers[i] *2);
}
6 changes: 4 additions & 2 deletions day_2/exercises/loops.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ for (var i = 0; i < 5; i++) {

// Write code below that logs to the console the sum of 2 plus 2 7 times:
for (var i = 0; i < 7; i++) {
// YOUR CODE HERE
console.log(2 + 2)
}

// Write code below that prints the phrase 'She sells seashells down by the seashore'
// 10 times.

// YOUR CODE HERE
for (var i = 0; i<10; i++) {
console.log("She sells seashells down by the seashore")
}
11 changes: 11 additions & 0 deletions day_2/questions.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
## Day 2 Questions

1. Declare a variable named `animals` that stores an array containing the following strings: `"zebra", "giraffe", "elephant"`.
var animals = ["zebra", "giraffe", "elephant"];

2. Using the array `animals`, how would you access `"giraffe"`?
console.log(animals[1]);

3. How would you add `"lion"` to the `animals` array?
animals.push("lion");

4. Name and describe two additional array methods.
The push method adds an element to the end of an array.

The pop method will remove the last element of an array and log that same element.

5. What are the boolean values in JavaScript?
true or false

6. In JavaScript, how would you evaluate if `2` is equal to `25`? What is the result of this evaluation?
console.log(2 == 25)
false

7. In JavaScript, how would you evaluate if `25` is greater than `2`? What is the result of this evaluation?
console.log(25 < 2)
false
7 changes: 7 additions & 0 deletions day_3/exercises/decision-making.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,23 @@ if (bearChoice === 1) {
/*
Reflection Questions
1. In English, using technical vocabulary, describe what is happening between lines 17 and 21.
We are using an if/else statement. If line 17 returns true bearClothing will be assigned "hat", if false "scarf" will be assigned to bearClothing.

2. What variable has a new value assigned to it after the first if statement executes?
bearChoice is assigned a new value after the first if statement executes.

3. If you changed the variable doorChoice to equal 3, what would the bearClothing value be?
The value would be bearClothing = "scarf". The outcome of hat is only possible when doorChoice is equal to 1.

4. In English, using technical vocabulary, describe what is happening between lines lines 31 and 38.
The outcomes of each door is shown on lines 31-38. If door 1 is chosen he shows you a way out. If 2, the bear begins to cry. If 3. You run into the next room which is full of snakes.

5. If you changed the variable bearChoice to equal 3, what will be the final outcome be?
The outcome would be "You run as fast as you can into the next room. It's full of snakes!"

6. If you changed the variable doorChoice to equal 1, and the variable bearChoice to equal 2, what will be the final outcome be?
You tell the bear the "hat" is too small and it starts to cry!

7. What is your favorite ending?
I like the ending of running into the snakes, its exciting and scary!
*/
23 changes: 19 additions & 4 deletions day_3/exercises/if-statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ with you to be prepared based on the following conditions:
if it is icy, log "yak traks"
*/

var weather = 'snowy';
var weather = 'sunny';

if (weather == 'sunny') {
console.log("sunscreen");
Expand Down Expand Up @@ -46,9 +46,16 @@ When numQuarters = 3, program should log "I have enough money for a gumball"
*/

var numQuarters = 0;

console.log("I have enough money for a gumball");
console.log("I don't have enough money for a gumball");
numQuarters = 1
if (numQuarters == 0) {
console.log("I don't have enough money for a gumball");
} else if (numQuarters == 1) {
console.log("I don't have enough money for a gumball");
} else if (numQuarters == 2) {
console.log("I have enough money for a gumball");
} else {
console.log("I have enough money for a gumball");
}

/* ----------------------------
Using the variables defined below, determine if you have the
Expand All @@ -64,3 +71,11 @@ When cupsOfFlour = 3 and hasSauce = true, your program should log "I can make pi

var cupsOfFlour = 1;
var hasSauce = true;

if (cupsOfFlour == 1){
console.log("I cannot make pizza");
}else if (cupsOfFlour >+2 && hasSauce == true){
console.log("I can make pizza");
}else if (cupsOfFlour >= 2 && hasSauce =- false){
console.log("I cannot make pizza")
}
Loading