Skip to content
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
1 change: 1 addition & 0 deletions Functions-Arrays-Objects
Submodule Functions-Arrays-Objects added at 74fdd0
18 changes: 15 additions & 3 deletions arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
console.log();

55 changes: 46 additions & 9 deletions functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
Expand All @@ -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))




Expand Down Expand Up @@ -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! 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/

Expand All @@ -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'),



}




Expand Down