diff --git a/Functions-Arrays-Objects b/Functions-Arrays-Objects new file mode 160000 index 0000000..74fdd0b --- /dev/null +++ b/Functions-Arrays-Objects @@ -0,0 +1 @@ +Subproject commit 74fdd0b6b46332280ac2353cebddf5691bb46a06 diff --git a/arrays.js b/arrays.js index d3825d8..9f0d486 100644 --- a/arrays.js +++ b/arrays.js @@ -76,11 +76,17 @@ let inventory = [ // ==== Challenge 1 ==== // The dealer can't recall the information for a car with an id of 33 on his lot. Help the dealer find out which car has an id of 33 by logging the car's year, make, and model in the console log provided to you below: console.log(`Car 33 is a *car year goes here* *car make goes here* *car model goes here*`); + + console.log(`Car 33 is a ${inventory[32] ['2011'}; ${'Jeep'}, ${'wrangeler'} `); + + + // ==== Challenge 2 ==== // The dealer needs the information on the last car in their inventory. What is the make and model of the last car in the inventory? Log the make and model into the console. let lastCar = 0; - console.log(); + console.log(inventory[inventory.leng-1]); + // ==== Challenge 3 ==== // The marketing team wants the car models listed alphabetically on the website. Sort all the car model names into alphabetical order and log the results in the console @@ -96,9 +102,15 @@ let inventory = [ // ==== Challenge 5 ==== // The car lot manager needs to find out how many cars are older than the year 2000. Using the carYears array you just created, find out how many cars were made before the year 2000 by populating the array oldCars and logging it's length. let oldCars = []; - console.log(); + for ( let i = 0, i < cars .length; i++) { + if ( cars [i] year <2000) { + oldCars.push(cars[i].car) + } + } + console.log(oldCars); // ==== Challenge 6 ==== // A buyer is interested in seeing only BMW and Audi cars within the inventory. Return an array that only contains BMW and Audi cars. Once you have populated the BMWAndAudi array, use JSON.stringify() to show the results of the array in the console. let BMWAndAudi = []; - console.log(); \ No newline at end of file + console.log(); + \ No newline at end of file diff --git a/functions.js b/functions.js index 2f809d2..c75bab1 100644 --- a/functions.js +++ b/functions.js @@ -8,12 +8,12 @@ Do the following: 3. Multiply a and b and return the answer */ -function multiply(/*add your code here*/){ - /*add your code here*/ +function multiply(a,b) { + return a * b; } - -/* + console.log(multiply(5,5)); + /* console log on the developer showed 25 and /*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 2: Age in Cat years 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/ @@ -25,9 +25,13 @@ Do the following: 3. Return the newly calculated age */ -function catYears(/*add your code here*/){ - /*add your code here*/ -} + + let catYears = function(num1 , num2) { + return num1 + num2; + + } + console.log(add(1, 7)) + @@ -64,6 +68,30 @@ add(1,2); */ + const myFunction = () => { + console.log("myFunction"); + } + myFunction(); + + let anotherFunction = (param) => { + return param; + } + +console.log(anotherFunction); + + +let add = (param1, param2) => { +return param1 + param2; + +} + +console.log((1,2)); + + + + + + /*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 4: Rock, Paper, Scissors - Let's play against the computer! 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/ @@ -84,8 +112,17 @@ Use the game function below to do the following: */ function game(user, computer){ - /*add your code here*/ -} + let user = 7; + let computer = 3; + if (user === 7 ) { + console.log('you win'), + } if (copmputer === 3 ) { + console.log('you win'), + + + + } +