Skip to content

Commit

Permalink
[prettier] fix syntax errors in files and run prettier on them
Browse files Browse the repository at this point in the history
  • Loading branch information
vegetabill committed Dec 14, 2020
1 parent cab822c commit 7dda60e
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 148 deletions.
51 changes: 16 additions & 35 deletions prework/1_VariablesExercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// exercise prompt.

// First try answering these without using references or looking up any information.
// Then, check your answer by using references and/or running your code.
// Then, check your answer by using references and/or running your code.
// You can run your JS code using the Chrome or Firefox Developer tools, or by using Node.js.
// Feel free to update your answers if you got them wrong at first -- this exercise is for your own learning.
// But make sure you understand why the correct answer is right.
Expand All @@ -13,58 +13,41 @@

// Exercise 1. Simply declare a variable named 'emptyVariable'



// Exercise 2. Declare a variable called 'myName'



// Exercise 3. Assign your name as the value for 'myName'



// Exercise 4. Declare a variable called dreamDestination and give it the value
// of what your dream vacation destination is.



// Exercise 5. Make the following variables and assignments
// - a variable called num1 with a value greater than 1 and less than 10
// - a variable called num2 with a value of greater than or equal to 1 and less
// than or equal to 10



// Exercise 6. Write a comment below explaining the difference between the rules
// for num1 and num2 from Exercise 5. What numbers would be valid values for
// for num1 and num2 from Exercise 5. What numbers would be valid values for
// num2 but not num1?
//


// Exercise 7. Now we will try some addition.
// a. Assign the the values of 4 and 6 to num1 and num2, respectively.
// b. Make a new variable called 'theSum', and use 'num1' and
// 'num2' to assign its value using the "+" operator.



// Exercise 8. Now we will try some multiplication.
// Make a new variable called 'theProduct', multiply num1 and num2 and assign
// the resulting value to 'theProduct'.



// Exercise 9.
// Make a new variable called 'statement' and using 'myName' and
// 'dreamDestination' and the concatenation method of your choice, make the
// value of statement to be:
// "Hi, my name is <your name>, and I can't wait to visit <your destination>!"



// *NOTE* For the following exercises, put your answers in the line below
// the description of each exercise. For example, below a prompt, you may see:
// let myAnswerForExercise10 = ;
// let myAnswerForExercise10= "";
// If your answer is "foo", then fill in the line to be:
// let myAnswerForExercise10 = "foo";

Expand All @@ -81,7 +64,7 @@ const myAnswerForExercise11 = "";
// Exercise 12. What do you think the value of emptyVariable is?
// Place your answer below:

const myAnswerForExercise12 = ;
const myAnswerForExercise12 = "";

// Exercise 13. If
const A = "R";
Expand All @@ -90,43 +73,41 @@ const C = 4;
const D = "D";

// What is the value of B + C
const myAnswerForExercise13 = ;
const myAnswerForExercise13 = "";

// Exercise 14 What is the value of
// A + "n" + D
const myAnswerForExercise14 = ;
const myAnswerForExercise14 = "";

// Exercise 15 What is the value of
// A + B * 2 + D + C / 2:
const myAnswerForExercise15 = ;
const myAnswerForExercise15 = "";

// Exercise 16 What is the value of A * B
const myAnswerForExercise16 = ;
const myAnswerForExercise16 = "";

// Exercise 17 What is the value of true || false
const myAnswerForExercise17 = ;
const myAnswerForExercise17 = "";

// Exercise 18 What is the value of 1 === "1"
const myAnswerForExercise18 = ;
const myAnswerForExercise18 = "";

// Exercise 19 What is the value of 1 == "1"
const myAnswerForExercise19 = ;
const myAnswerForExercise19 = "";

// Exercise 20 What is the value of 1 < 1
const myAnswerForExercise20 = ;
const myAnswerForExercise20 = "";

// Exercise 21 What is the value of 1 < 2 < 3
const myAnswerForExercise21 = ;
const myAnswerForExercise21 = "";

// Exercise 22 What is the value of 2 < 1 < 3
const myAnswerForExercise22 = ;
const myAnswerForExercise22 = "";

// Congrats, you made it to the end!
// Did you find this easy or hard? If you used references, which ones helped you?
// Did you find this easy or hard? If you used references, which ones helped you?
// Please answer in a comment below.
//

// Email your file to the course staff,
// Email your file to the course staff,
// or commit your file to GitHub and email us a link.


39 changes: 14 additions & 25 deletions prework/3_LoopsExercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,45 @@
// exercise prompt.

// First try answering these without using references or looking up any information.
// Then, check your answer by using references and/or running your code.
// Then, check your answer by using references and/or running your code.
// You can run your JS code using the Chrome or Firefox Developer tools, or by using Node.js.
// Feel free to update your answers if you got them wrong at first -- this exercise is for your own learning.
// But make sure you understand why the correct answer is right.

// Exercise 1. Write a 'while' loop that prints the integers (whole numbers)
// between 1 and 5 (inclusive).


// Exercise 2. Write a 'do while' loop that prints the integers (whole numbers)
// between 1 and 5 (inclusive).


// Exercise 3. Write a 'for' loop that prints the integers (whole numbers)
// between 1 and 5 (inclusive).


// Exercise 4. Now we want a loop that prints the integers
// Exercise 4. Now we want a loop that prints the integers
// counting DOWN from 10 to 1 (inclusive). Write three loops that do this, to practice
// writing loops in all 3 ways -- as a 'while', 'do while', and 'for' loop.


// Exercise 5. Write a loop that prints the integers from 7 to 27. Write this
// Exercise 5. Write a loop that prints the integers from 7 to 27. Write this
// loop in all 3 ways -- as a 'while', 'do while', and 'for' loop.


// Exercise 6. Write a loop that prints numbers between 0 and 100, counting by tens.
// I.e. it will print 10, then 20, then 30, etc.
// I.e. it will print 10, then 20, then 30, etc.
// Write this loop in all 3 ways -- as a 'while', 'do while', and 'for' loop.


// Exercise 7. Add a comment as to why the following loop is an infinite loop (will
// Exercise 7. Add a comment as to why the following loop is an infinite loop (will
// run without ever stopping). Then fix the loop so that it stops when
// counterFour is equal to -100.

let counterFour = 1;
while (counterFour < 2) {
console.log('HELP ME!')
console.log("HELP ME!");
counterFour--;
}


// Exercise 8. Make a variable that contains your favorite integer. Write a loop
// Exercise 8. Make a variable that contains your favorite integer. Write a loop
// (your choice which type) that prints the integers from 0 to that number.


// Exercise 9. Make a variable that contains your favorite integer (this time make sure it's
// Exercise 9. Make a variable that contains your favorite integer (this time make sure it's
// less than 100). Write a loop (your choice which type) that prints the integers from 0 to 100.
// Next to each number it should print "not my favorite number". But next to your favorite
// number it should print "my favorite number!". Example output (if your favorite number was 2):
Expand All @@ -61,14 +53,12 @@ while (counterFour < 2) {
// ...
// (Hint - use an if statement in your loop)


// Exercise 10. In some of the exercises above, we had you write all 3 types of loops, for practice.
// But in real life, how would you decide which type of loop to use? You might not have an
// exact answer, but spend a few minutes thinking about the different types of loops and/or
// exact answer, but spend a few minutes thinking about the different types of loops and/or
// doing some research and write down your thoughts in a comment below:
//


// Exercise 11. Now we'll practice using nested loops (a loop inside another loop)!
// Update the nested loops below to so that for each value of outsideCounter,
// the inside loop will show a countdown
Expand All @@ -90,17 +80,16 @@ inside 1
***********************************
*/

for (let outsideCounter = 0; outsideCounter <= 3; ???) {
for (let outsideCounter = 0; outsideCounter <= 3 /*???*/; ) {
console.log("counting down from", outsideCounter);
for (let insideCounter = outsideCounter; ???; ???) {
console.log("inside", ???);
for (let insideCounter = outsideCounter /*???*/ /*???*/; ; ) {
console.log("inside" /*???*/);
}
console.log("***********************************")
console.log("***********************************");
}


// Congrats, you made it to the end!
// Did you find this easy or hard? If you used references, which ones helped you?
// Did you find this easy or hard? If you used references, which ones helped you?
// Please answer in a comment below.
//

Expand Down
Loading

0 comments on commit 7dda60e

Please sign in to comment.