diff --git a/arrays/exercises/part-five-arrays.js b/arrays/exercises/part-five-arrays.js index 4cdf1bba41..a2f60dbc8c 100644 --- a/arrays/exercises/part-five-arrays.js +++ b/arrays/exercises/part-five-arrays.js @@ -3,9 +3,29 @@ let arr = ['B', 'n', 'n', 5]; //1) Use the split method on the string to identify the purpose of the parameter inside the (). +console.log(str.split(' ')); + +//the delimiter inside the .split() method determines the way the sting is broken up + //2) Use the join method on the array to identify the purpose of the parameter inside the (). +console.log(arr.join('a')); + +//the connector inside the .join() method is placed between each character in the string. + //3) Do split or join change the original string/array? +console.log(str); +console.log(arr); + +//these methods do not change the original string or array. + //4) We can take a comma-separated string and convert it into a modifiable array. Try it! Alphabetize the cargoHold string, and then combine the contents into a new string. let cargoHold = "water,space suits,food,plasma sword,batteries"; + +// cargoHold = cargoHold.split(','); +// cargoHold.sort(); +// cargoHold = cargoHold.join(" "); +// console.log(cargoHold); + +console.log(cargoHold = cargoHold.split(',').sort().join(", ")); \ No newline at end of file diff --git a/arrays/exercises/part-four-arrays.js b/arrays/exercises/part-four-arrays.js index 498149702e..44d90dfbfb 100644 --- a/arrays/exercises/part-four-arrays.js +++ b/arrays/exercises/part-four-arrays.js @@ -5,6 +5,18 @@ let holdCabinet2 = ['orange drink', 'nerf toys', 'camera', 42, 'parsnip']; //1) Print the result of using concat on the two arrays. Does concat alter the original arrays? Verify this by printing holdCabinet1 after using the method. +console.log(holdCabinet1.concat(holdCabinet2)); +console.log(holdCabinet1); + //2) Print a slice of two elements from each array. Does slice alter the original arrays? +console.log(holdCabinet1.slice(0, 2)); +console.log(holdCabinet1); + //3) reverse the first array, and sort the second. What is the difference between these two methods? Do the methods alter the original arrays? + +console.log(holdCabinet1.reverse()); +console.log(holdCabinet2.sort()); +console.log(holdCabinet1.concat(holdCabinet2)); + +//these methods alter the original array diff --git a/arrays/exercises/part-one-arrays.js b/arrays/exercises/part-one-arrays.js index 92f4e45170..8d24809b07 100644 --- a/arrays/exercises/part-one-arrays.js +++ b/arrays/exercises/part-one-arrays.js @@ -1,5 +1,18 @@ //Create an array called practiceFile with the following entry: 273.15 +let practiceFile = [273.15]; +console.log(practiceFile); + //Use the bracket notation method to add "42" and "hello" to the array. Add these new items one at a time. Print the array after each step to confirm the changes. +practiceFile.push(42); +console.log(practiceFile); + +practiceFile.push("hello"); +console.log(practiceFile); + + //Use a single .push() to add the following items: false, -4.6, and "87". Print the array to confirm the changes. + +practiceFile.push(false, -4.6, "87"); +console.log(practiceFile); diff --git a/arrays/exercises/part-six-arrays.js b/arrays/exercises/part-six-arrays.js index d0a28bed56..a3dc0beb4e 100644 --- a/arrays/exercises/part-six-arrays.js +++ b/arrays/exercises/part-six-arrays.js @@ -1,11 +1,31 @@ //Arrays can hold different data types, even other arrays! A multi-dimensional array is one with entries that are themselves arrays. + //1) Define and initialize the arrays specified in the exercise to hold the name, chemical symbol and mass for different elements. +let element1 = ['hydrogen', 'H', 1.008]; +let element2 = ['helium', 'He', 4.003]; +let element26 = ['iron', 'Fe', 55.85]; + //2) Define the array 'table', and use 'push' to add each of the element arrays to it. Print 'table' to see its structure. +let table = [] +table.push(element1, element2, element26); +console.log(table); + //3) Use bracket notation to examine the difference between printing 'table' with one index vs. two indices (table[][]). +console.log(table[1]); +console.log(table[1][0]); + //4) Using bracket notation and the table array, print the mass of element1, the name for element 2 and the symbol for element26. +console.log(table[0][2]); +console.log(table[1][0]); +console.log(table[2][1]); + //5) 'table' is an example of a 2-dimensional array. The first “level” contains the element arrays, and the second level holds the name/symbol/mass values. Experiment! Create a 3-dimensional array and print out one entry from each level in the array. + +element1.push(element2); +console.log(element1); +console.log(element1[3][2]); diff --git a/arrays/exercises/part-three-arrays.js b/arrays/exercises/part-three-arrays.js index d43918a702..4e02640f13 100644 --- a/arrays/exercises/part-three-arrays.js +++ b/arrays/exercises/part-three-arrays.js @@ -4,6 +4,14 @@ let cargoHold = [1138, 'space suits', 'parrot', 'instruction manual', 'meal pack //1) Insert the string 'keys' at index 3 without replacing any other entries. +cargoHold.splice(3,0, 'keys'); +console.log(cargoHold); + //2) Remove ‘instruction manual’ from the array. (Hint: indexOf is helpful to avoid manually counting an index). +console.log(cargoHold.indexOf('instruction manual')) +cargoHold.splice(4, 1); +console.log(cargoHold); //3) Replace the elements at indexes 2 - 4 with the items ‘cat’, ‘fob’, and ‘string cheese’. +cargoHold.splice(2, 3, 'cat', 'fob', 'string cheese'); +console.log(cargoHold); \ No newline at end of file diff --git a/arrays/exercises/part-two-arrays.js b/arrays/exercises/part-two-arrays.js index a940b1d0ff..4532ee32af 100644 --- a/arrays/exercises/part-two-arrays.js +++ b/arrays/exercises/part-two-arrays.js @@ -1,11 +1,28 @@ let cargoHold = ['oxygen tanks', 'space suits', 'parrot', 'instruction manual', 'meal packs', 'slinky', 'security blanket']; +console.log(cargoHold); //1) Use bracket notation to replace ‘slinky’ with ‘space tether’. Print the array to confirm the change. +cargoHold[5] = 'space tether'; + // cargoHold.splice(5, 1, 'space tether'); also does this (without brackets) +console.log(cargoHold); + //2) Remove the last item from the array with pop. Print the element removed and the updated array. +console.log(cargoHold.pop()); +console.log(cargoHold); + //3) Remove the first item from the array with shift. Print the element removed and the updated array. +console.log(cargoHold.shift()); +console.log(cargoHold); + //4) Unlike pop and shift, push and unshift require arguments inside the (). Add the items 1138 and ‘20 meters’ to the the array - the number at the start and the string at the end. Print the updated array to confirm the changes. +cargoHold.unshift(1138); +cargoHold.push('20 meters'); +console.log(cargoHold); + //5) Use a template literal to print the final array and its length. + +console.log(`The final array includes the following ${cargoHold.length} elements: [${cargoHold}].`) \ No newline at end of file diff --git a/arrays/exercises/tempCodeRunnerFile.js b/arrays/exercises/tempCodeRunnerFile.js new file mode 100644 index 0000000000..76274020a6 --- /dev/null +++ b/arrays/exercises/tempCodeRunnerFile.js @@ -0,0 +1,2 @@ +console.log(holdCabinet1.slice(0, 2)); +// console.log(holdCabinet1); \ No newline at end of file diff --git a/arrays/sandbox.js b/arrays/sandbox.js new file mode 100644 index 0000000000..ab16cb0c92 --- /dev/null +++ b/arrays/sandbox.js @@ -0,0 +1,5 @@ +let groceryBag = ['bananas', 'apples', 'edamame', 'chips', 'cucumbers', 'milk', 'cheese']; +let selectedItems = []; + +selectedItems = groceryBag.slice(2, 5).sort(); +console.log(selectedItems); \ No newline at end of file diff --git a/arrays/studio/array-string-conversion/array-testing.js b/arrays/studio/array-string-conversion/array-testing.js index c4d5899385..48b2fa5d10 100644 --- a/arrays/studio/array-string-conversion/array-testing.js +++ b/arrays/studio/array-string-conversion/array-testing.js @@ -8,8 +8,15 @@ strings = [protoArray1, protoArray2, protoArray3, protoArray4]; //2) function reverseCommas() { //TODO: 1. create and instantiate your variables. - let check; - let output; + let check + // console.log(check); + let output = protoArray1.split(",").reverse().join(","); + +/* Use the reverseCommas() function to code the following. +If the string uses commas to separate the words, split it into an array, reverse the entries, +and then join the array into a new comma-separated string. For example, "up,to,code,fun" becomes "fun,code */ + + //TODO: 2. write the code required for this step //NOTE: For the code to run properly, you must return your output. this needs to be the final line of code within the function's { }. diff --git a/arrays/studio/string-modification.js b/arrays/studio/string-modification.js index 45991b15fc..8482d1d2f9 100644 --- a/arrays/studio/string-modification.js +++ b/arrays/studio/string-modification.js @@ -3,9 +3,26 @@ let str = "LaunchCode"; //1) Use string methods to remove the first three characters from the string and add them to the end. //Hint - define another variable to hold the new string or reassign the new string to str. +let newStr = str.slice(3,10).concat(str.slice(0,3)); +console.log(newStr); //Use a template literal to print the original and modified string in a descriptive phrase. +console.log(`${newStr} is a mixed up version of ${str}.`); + //2) Modify your code to accept user input. Query the user to enter the number of letters that will be relocated. -//3) Add validation to your code to deal with user inputs that are longer than the word. In such cases, default to moving 3 characters. Also, the template literal should note the error. +userInput = 0; +userInput = input.question("Input how many letters that you want to be relocated: "); +console.log(userInput); + +//3) Add validation to your code to deal with user inputs that are longer than the word. +//In such cases, default to moving 3 characters. Also, the template literal should note the error. + +if (userInput > str.length) { + console.log(`Your entry (${userInput}) exceeds the maximum number of characters possible (${str.length}).`); + userInput = 3; +} else { + console.log ("cool!"); +} + diff --git a/booleans-and-conditionals/boolean/boolean-conversion.js b/booleans-and-conditionals/boolean/boolean-conversion.js new file mode 100644 index 0000000000..afb76fbcaa --- /dev/null +++ b/booleans-and-conditionals/boolean/boolean-conversion.js @@ -0,0 +1,6 @@ +console.log(Boolean("true")); +console.log(Boolean("TRUE")); +console.log(Boolean(0)); +console.log(Boolean(1)); +console.log(Boolean('')); +console.log(Boolean('LaunchCode')); \ No newline at end of file diff --git a/booleans-and-conditionals/boolean/boolean-practice.js b/booleans-and-conditionals/boolean/boolean-practice.js new file mode 100644 index 0000000000..a1e5a62cf3 --- /dev/null +++ b/booleans-and-conditionals/boolean/boolean-practice.js @@ -0,0 +1,13 @@ +//prints to console whether the value is EVEN, EVAN and POSITIVE, or NOT EVEN + +let num = -7; + +if (num % 2 === 0) { + console.log("EVEN"); + + if (num > 0) { + console.log("POSITIVE"); + } +} else { + console.log("NOT EVEN") +} \ No newline at end of file diff --git a/booleans-and-conditionals/exercises/part-1.js b/booleans-and-conditionals/exercises/part-1.js index b829140a07..a3c25c56ae 100644 --- a/booleans-and-conditionals/exercises/part-1.js +++ b/booleans-and-conditionals/exercises/part-1.js @@ -1,7 +1,39 @@ // Declare and initialize the variables for exercise 1 here: +let engineIndicatorLight = "NOT red blinking"; +let spaceSuitsOn = true; +let shuttleCabinReady = true; +let crewStatus = spaceSuitsOn && shuttleCabinReady; +let computerStatusCode = 200; +let shuttleSpeed = 15000; +let fuelLevel = 19000; +let engineTemperature = 2500; +let commandOverride = false; -// BEFORE running the code, predict what will be printed to the console by the following statements: +//Monitor shuttle's fuel status + +if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking") { + console.log("ENGINE FAILURE IMMINENT!"); +} else if (fuelLevel > 20000 && engineTemperature <= 2500) { + console.log("Full tank. Engines good.") +} else if (fuelLevel > 10000 && engineTemperature <= 2500) { + console.log("Fuel level above 50%. Engines good."); +} else if (fuelLevel <= 5000 || engineTemperature > 2500) { + console.log("Check fuel level. Engines running hot."); +} else if (fuelLevel > 5000 && engineTemperature <= 2500) { + console.log("Fuel level above 25%. Engines good."); +} else { + console.log("Fuel and engine status pending..."); +} + +if (fuelLevel > 20000 && engineIndicatorLight === "NOT red blinking" ||commandOverride === true) { + console.log("Cleared to launch!"); +} else { + console.log("Launch scrubbed!") +} + +// BEFORE running the code, predict what will be printed to the console by the following statements: +/* if (engineIndicatorLight === "green") { console.log("engines have started"); } else if (engineIndicatorLight === "green blinking") { @@ -9,3 +41,50 @@ if (engineIndicatorLight === "green") { } else { console.log("engines are off"); } + +// Printed to the console: "engines are off" + +// Safety Rules: + +if (crewStatus) { + console.log("Crew Ready"); +} else { + console.log("Crew Not Ready"); +} + +if (computerStatusCode === 200) { + console.log("Please stand by. Computer is rebooting."); +} else if (computerStatusCode === 400) { + console.log("Success! Computer online."); +} else { + console.log("ALERT: Computer offline!"); +} + +if (shuttleSpeed > 17500) { + console.log("ALERT: Escape velocity reached!"); +} else if (shuttleSpeed < 8000) { + console.log("ALERT: Cannot maintain orbit!"); +} else { + console.log("Stable speed"); +} + + + +//compare output of two conditionals: + +if (crewStatus && computerStatusCode === 200 && spaceSuitsOn) { + console.log("all systems go"); +} else { + console.log("WARNING. Not ready"); +} + +if (!crewStatus || computerStatusCode !== 200 || !spaceSuitsOn) { + console.log("WARNING. Not ready"); +} else { + console.log("all systems go"); +} + +*/ + + + diff --git a/booleans-and-conditionals/exercises/tempCodeRunnerFile.js b/booleans-and-conditionals/exercises/tempCodeRunnerFile.js new file mode 100644 index 0000000000..130e16f6ba --- /dev/null +++ b/booleans-and-conditionals/exercises/tempCodeRunnerFile.js @@ -0,0 +1 @@ +1200 \ No newline at end of file diff --git a/booleans-and-conditionals/studio/data-variables-conditionals.js b/booleans-and-conditionals/studio/data-variables-conditionals.js index 6a15e146f4..32f04e7a99 100644 --- a/booleans-and-conditionals/studio/data-variables-conditionals.js +++ b/booleans-and-conditionals/studio/data-variables-conditionals.js @@ -1,15 +1,67 @@ // Initialize Variables below +let date = "Monday 2019-03-18"; +let time = "10:05:34 AM"; +let astronautCount = 7; +let astronautStatus = "ready"; +let averageAstronautMassKg = 80.7 +let crewMassKg = astronautCount * averageAstronautMassKg +let fuelMassKg = 760000 +let shuttleMassKg = 74842.31 +let totalMassKg = crewMassKg + fuelMassKg + shuttleMassKg; +let maximumMassLimit = 850000; +let fuelTempCelsius = -225; +let minimumFuelTemp = -300; +let maximumFuelTemp = -150; +let fuelLevel = "100%"; +let weatherStatus = "clear"; +let preparedForLiftOff = true; +let astronautCheck; +let massOk; +let fuelTempOk; -// add logic below to verify total number of astronauts for shuttle launch does not exceed 7 +// add logic below to verify total number of astronauts for shuttle launch does not exceed 7 +if (astronautCount <= 7) { + astronautCheck = true; +} // add logic below to verify all astronauts are ready - +if (astronautStatus !== "ready") { + preparedForLiftOff = false; +} // add logic below to verify the total mass does not exceed the maximum limit of 850000 - +if (totalMassKg <= maximumMassLimit) { + massOk = true; +} // add logic below to verify the fuel temperature is within the appropriate range of -150 and -300 +if (fuelTempCelsius >= minimumFuelTemp && fuelTempCelsius <= maximumFuelTemp) { + fuelTempOk = true; +} // add logic below to verify the fuel level is at 100% - +if (fuelLevel !== "100%") { + preparedForLiftOff = false; +} // add logic below to verify the weather status is clear - +if (weatherStatus !== "clear") { + preparedForLiftOff = false; +} // Verify shuttle launch can proceed based on above conditions +if (astronautCheck && astronautStatus === "ready" && massOk && fuelTempOk && fuelLevel === "100%" && weatherStatus === "clear") { + preparedForLiftOff = true; +} else { + preparedForLiftOff = false; +} + +if (preparedForLiftOff = true) { + console.log("All systems are go. Initialize space sequence."); + console.log("Date: " + date); + console.log("Time: " + time); + console.log("Astronaut Count: " + astronautCount); + console.log("Crew Mass: " + crewMassKg); + console.log("Fuel Mass: " + fuelMassKg); + console.log("Shuttle Mass: " + shuttleMassKg); + console.log("Total Mass: " + totalMassKg); + console.log("Fuel Temp: " + fuelTempCelsius); + console.log("Weather Status: " + weatherStatus); + console.log("Have a safe trip, astronauts.") +} \ No newline at end of file diff --git a/classes/chapter-examples/ClassExamples01.js b/classes/chapter-examples/ClassExamples01.js index 84d2b87dc9..80b7d82816 100644 --- a/classes/chapter-examples/ClassExamples01.js +++ b/classes/chapter-examples/ClassExamples01.js @@ -1,9 +1,10 @@ //Try adding new properties inside constructor. class Astronaut { - constructor(name, age, mass){ + constructor(name, age, mass, gender){ this.name = name; this.age = age; this.mass = mass; + this.gender = gender; } } @@ -18,4 +19,13 @@ fox.color = 'red'; console.log(fox); console.log(fox.age, fox.color); -//Try modifying or adding properties below. \ No newline at end of file +//Try modifying or adding properties below. + +let eagle = new Astronaut('Eagle', 10, 15, 'female'); + +console.log(eagle); + +eagle.age = 11; +eagle.color = 'black'; + +console.log(eagle.gender); \ No newline at end of file diff --git a/classes/chapter-examples/ClassExamples02.js b/classes/chapter-examples/ClassExamples02.js index 5f7ee4e0fd..c12d1442ac 100644 --- a/classes/chapter-examples/ClassExamples02.js +++ b/classes/chapter-examples/ClassExamples02.js @@ -3,7 +3,7 @@ // Next, set default values for 1 or more of the parameters in constructor. class Astronaut { - constructor(name, age, mass){ + constructor(name = 'unnamed', age = 'unknown age', mass ='unknown age'){ this.name = name; this.age = age; this.mass = mass; @@ -14,4 +14,19 @@ let tortoise = new Astronaut('Speedy', 120); console.log(tortoise.name, tortoise.age, tortoise.mass); -// What happens if we call Astronaut and pass in MORE than 3 arguments? TRY IT! \ No newline at end of file +// What happens if we call Astronaut and pass in MORE than 3 arguments? TRY IT! + +let eagle = new Astronaut(); + +console.log(eagle); + +class Car { + constructor(make, year) { + this.make = make; + this.year = year; + } +} + +let newCar = new Car('Toyota', 2024); + +console.log(typeof newCar.make, typeof newCar.year); \ No newline at end of file diff --git a/classes/exercises/ClassExercises.js b/classes/exercises/ClassExercises.js index 91b9ee5b9d..c1357b18cc 100644 --- a/classes/exercises/ClassExercises.js +++ b/classes/exercises/ClassExercises.js @@ -1,10 +1,60 @@ // Define your Book class here: +class Book { + constructor(title, author, copyright, ISBN, pageCount, checkoutCount, discarded = 'false') { + this.title = title; + this.author = author; + this.copyright = copyright; + this.ISBN = ISBN; + this.pageCount = pageCount; + this.checkoutCount = checkoutCount; + this.discarded = discarded; + } + + checkout(uses = 1) { + this.checkoutCount += uses; + } +} // Define your Manual and Novel classes here: +class Manual extends Book { + constructor(title, author, copyright, ISBN, pageCount, checkoutCount, discarded) { + super(title, author, copyright, ISBN, pageCount, checkoutCount, discarded); + } + + replace(currentYear) { + if (currentYear - this.copyright > 5) { + this.discarded = 'true'; + } + } +} + +class Novel extends Book { + constructor(title, author, copyright, ISBN, pageCount, checkoutCount, discarded) { + super(title, author, copyright, ISBN, pageCount, checkoutCount, discarded); + } + + replace() { + if (this.checkoutCount > 100) { + this.discarded = 'true'; + } + } +} // Declare the objects for exercises 2 and 3 here: +let pride = new Novel('Pride and Prejudice', 'Jane Austen', 1813, 1111111111111, 432, 32, 'false'); + +let topSecret = new Manual('Top Secret Shuttle Building Manual', 'Redacted', 2013, 0000000000000, 1147, 1, 'false'); + +// Code exercises 4 & 5 here: + +topSecret.replace(2024); + +console.log(topSecret); + +pride.checkout(5); +pride.replace(); -// Code exercises 4 & 5 here: \ No newline at end of file +console.log(pride); \ No newline at end of file diff --git a/classes/studio/ClassStudio.js b/classes/studio/ClassStudio.js index c3a6152140..3514b05161 100644 --- a/classes/studio/ClassStudio.js +++ b/classes/studio/ClassStudio.js @@ -1,6 +1,65 @@ //Declare a class called CrewCandidate with a constructor that takes three parameters—name, mass, and scores. Note that scores will be an array of test results. +class CrewCandidate { + constructor(name, mass, scores) { + this.name = name; + this.mass = mass; + this.scores = scores; + } + addScore(newScore) { + this.scores.push(newScore); + } + + average() { + const sum = this.scores.reduce(function(accumulator, currentValue) { + return accumulator + currentValue; + }, 0); + + return Math.round((sum/this.scores.length)*10)/10; + } + + status() { + let average = this.average(); + if (average >= 90) { + return 'Accepted' + } else if (average >= 80 && average <= 89) { + return 'Reserve' + } else if (average >= 70 && average <= 79) { + return 'Probationary' + } else { + return 'Rejected' + } + + } +} + +let crewCandidate1 = new CrewCandidate ('Bubba Bear', 135, [88, 85, 90]); +let crewCandidate2 = new CrewCandidate ('Merry Maltese', 1.5, [93, 88, 97]); +let crewCandidate3 = new CrewCandidate ('Glad Gator', 225, [75, 78, 62]); + + +console.log(`${crewCandidate1.name} earned an average test score of ${crewCandidate1.average()}% and has a status of ${crewCandidate1.status()}.`); + +let noOfTestsToAccepted = 0; +let noOfTestsToReserved = 0; + +while (crewCandidate3.average() < 80) { + + crewCandidate3.addScore(100); + console.log(crewCandidate3.average()); + noOfTestsToReserved++; +} + +while (crewCandidate3.average() < 90) { + + crewCandidate3.addScore(100); + console.log(crewCandidate3.average()); + noOfTestsToAccepted++; +} + +console.log(crewCandidate3.status()); +console.log(`It took ${crewCandidate3.name} ${noOfTestsToAccepted} tests to get Accepted and ${noOfTestsToReserved} tests to get Reserved.`); //Add methods for adding scores, averaging scores and determining candidate status as described in the studio activity. diff --git a/css/exercises/index.html b/css/exercises/index.html index 922e8e3885..91fbc93f06 100644 --- a/css/exercises/index.html +++ b/css/exercises/index.html @@ -9,13 +9,13 @@
-Web Development is a very cool skill that I love learning!
I love making websites because all I have to do is reload the page to see the changes I have made!
diff --git a/css/exercises/styles.css b/css/exercises/styles.css index 3b88bed453..7345caaa58 100644 --- a/css/exercises/styles.css +++ b/css/exercises/styles.css @@ -1 +1,24 @@ /* Start adding your styling below! */ +body { + background-color: yellow; +} + +p { + color: green; +} + +h1 { + font-size: 36px; +} + +.center { + text-align: center; +} + +#cool-text { + color: blue; +} + +#list-color { + color: blueviolet; +} \ No newline at end of file diff --git a/data-and-variables/chapter-examples/bruces-beard.js b/data-and-variables/chapter-examples/bruces-beard.js index 5b4352ebb8..8ba579ac5e 100644 --- a/data-and-variables/chapter-examples/bruces-beard.js +++ b/data-and-variables/chapter-examples/bruces-beard.js @@ -1 +1 @@ -console.log('Bruce's beard'); +console.log("Bruce's beard"); diff --git a/data-and-variables/exercises/data-and-variables-exercises.js b/data-and-variables/exercises/data-and-variables-exercises.js index 6433bcd641..36efce3fd3 100644 --- a/data-and-variables/exercises/data-and-variables-exercises.js +++ b/data-and-variables/exercises/data-and-variables-exercises.js @@ -1,11 +1,32 @@ // Declare and assign the variables below +let shuttleName = "Determination"; +let shuttleSpeedMph = 17500; +let marsDistanceKm = 225000000; +let moonDistanceKm = 384400; +const milesPerKm = 0.621; // Use console.log to print the 'typeof' each variable. Print one item per line. +console.log(typeof shuttleName); +console.log(typeof shuttleSpeedMph); +console.log(typeof marsDistanceKm); +console.log(typeof moonDistanceKm); +console.log(typeof milesPerKm); // Calculate a space mission below +let milesToMars = marsDistanceKm * milesPerKm; +let hoursToMars = milesToMars / shuttleSpeedMph; +let daysToMars = hoursToMars / 24; // Print the results of the space mission calculations below +console.log(shuttleName + " will take " + daysToMars + " days to reach Mars."); + // Calculate a trip to the moon below -// Print the results of the trip to the moon below \ No newline at end of file +let milesToMoon = moonDistanceKm * milesPerKm; +let hoursToMoon = milesToMoon / shuttleSpeedMph; +let daysToMoon = hoursToMoon / 24; + +// Print the results of the trip to the moon below + +console.log(shuttleName + " will take " + daysToMoon + " days to reach the Moon.") \ No newline at end of file diff --git a/dom-and-events/chapter-examples/sandbox.html b/dom-and-events/chapter-examples/sandbox.html new file mode 100644 index 0000000000..e117e43825 --- /dev/null +++ b/dom-and-events/chapter-examples/sandbox.html @@ -0,0 +1,29 @@ + + + ++ a bunch of really valuable text... +
+ + + + + \ No newline at end of file diff --git a/dom-and-events/chapter-examples/sandbox2.html b/dom-and-events/chapter-examples/sandbox2.html new file mode 100644 index 0000000000..d9c10cc418 --- /dev/null +++ b/dom-and-events/chapter-examples/sandbox2.html @@ -0,0 +1,31 @@ + + + +Hello, world!
+ +I want to make a website that can be a landing page for my Music Education company Sound Theory Academcy