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
61 changes: 60 additions & 1 deletion arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,31 +81,90 @@ let inventory = [

// console.log(`Car 33 is a *car year goes here* *car make goes here* *car model goes here*`);

console.log(inventory[32].id, inventory[32].car_year, inventory[32].car_make, inventory[32].car_model);


// ==== 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.

// Waxay rabaan inay ogaadaan macluumaadka gaariga ugu dambeeyay. Waxaa ka mid ah inay noocuu yahay (make) iyo modelka gaariga ugu dambeeyay.

console.log(inventory[49].car_make, inventory[49].car_model)

// ==== 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

// Dadka qaabilsan xayaysiinta ayaa rabo in gawaarida loo soo bandhigo xarfaha habkey iskugu xigaan (alphabetically) si ay website-ka u galiyaan. Magacyada gawaawida oo dhan isku habee si A-Z ah kadibna console.log ku samee.

let carModels = [];
let a=[]
for(let i=0;i<inventory.length;i++)
{
a.push(inventory[i]["car_model"])
}
a.sort()
for(let i=0;i<a.length;i++)
{
console.log(a[i])

}

// ==== Challenge 4 ====
// The accounting team needs all the years from every car on the lot. Create a new array from the dealer data containing only the car years and log the result in the console.

// Dadka qaabilsan xisaabinta ayaa rabo inay ogaadaan sanadyada gawaarida oo dhan. Array cusub samee, kadibna ku shub sanadyada gawaarida oo dhan kadibna console.log ku samee.


let allyear =[];
let greatnew = [];

for(let i = 0; i<inventory.length; i++){
greatnew.push(inventory[i]['car_year'])
}
for (let i = 0;i<greatnew.length;i++){

console.log(greatnew[i])
}
// ==== Challenge 5 ====
// The car lot manager needs to find out how many cars are older than the year 2000. Find out how many cars were made before the year 2000 by populating the array oldCars and logging it's length.

// Qofka maamulo ganacsiga ayaa rabo inuu ogaado inta gaari oo ka horeysay sanadkii 2000. Isticmaal array 'oldCars', kuna shub gawaarida ka horeysay 2000. Kadib console log ku samee.






let oldCars =[];

let =[]
for(let i=0;i<inventory.length;i++)
{
if (inventory[i]["car_year"]<2000)
{
oldCars.push(inventory[i]["car_make"])
}
}
console.log(oldCars.length)


// ==== 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.

// Qof rabo inuu gaari gato ayaa rabo inuu ogaado inta BMW iyo Audi yaalo. Array 'BMWAndAudi' la dhaho ku shub dhamaan gawaarida BMW iyo Audi. Kadib adigoo isticmaalaayo JSON.stringify() console.log ku samee.


let BMWAndAudi =[];
console.log();
let A =[]
for(let i=0;i<inventory.length;i++)
{
if (inventory[i]["car_make"]==="BMW" || inventory[i]["car_make"]==="Audi")
{
A.push(inventory[i])
}
}
for(let i=0;i<A.length;i++)
{
let result = JSON.stringify(A[i]);
console.log(result)
}
38 changes: 38 additions & 0 deletions basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Do the following:
*/


const age = "1999";

console.log(parseFloat(age));


/*
Task: Mood Checker

Expand All @@ -20,6 +25,16 @@ Do the following:

*/

// const mood=prompt("enter your mood");
// if(mood ==="happy") {
// console.log("Yay me too!");
// }
// else if (mood==="sad"){
// console.log("Aw cheer up");
// }
// else{
// console.log("so moody");
// };

/*
Task: Odd or Even / kisi ama dhaban
Expand All @@ -30,6 +45,14 @@ Adigoo 'if/else' isticmaalaayo hubi in nambar uu yahay 'kisi ama dhaban', kadi c

*/

// const number =prompt("enter your number")
// if(number % 2 == 0){
// console.log("the number is even ")
// }else {console.log("the number is odd ")

// }


var num = 16; // You can change this number! / Number-kaan ku bilow

// write your conditions here / Code-kaada halkaan ku qor
Expand Down Expand Up @@ -93,6 +116,21 @@ It's okay for it to be slow.

*/

function fizzbuzz(){
for(let i = 1; i<=100;i++ ){
if(i % 3 === 0 && i % 5 === 0){
console.log("fizzbuzz");
}else if(i % 3 === 0 ){
console.log("fizz");
}else if (i % 5 === 0){
console.log("Buzz");
}else{
console.log(i)
}

}
};
fizzbuzz()

/*💪💪💪💪💪💪💪💪💪💪 Stretch 💪💪💪💪💪💪💪💪💪💪*/

Expand Down
64 changes: 63 additions & 1 deletion functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,33 @@ add(1,2);
*/


const myFunction = () => {
console.log("Function was invoked!");
};
myFunction();






let anotherFunction =(param) =>{
return param;
};

anotherFunction("example");





/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task: Rock, Paper, Scissors - Let's play against the computer! 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
let add = (param1, param2)=> {
return param1 + param2;
};

add(1,2);

/*🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task: Rock, Paper, Scissors - Let's play against the computer! 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/

/*
Create a global variable that randomly generates the computer's choice
Expand All @@ -52,3 +77,40 @@ Use the game function below to do the following:
function game(user, computer){
/*add your code here*/
}

// 1 = rock
// 2= paper
// 3 =sisscer

let myNum1 = Math.floor((Math.random()* 3 )+ 1);
let mychioce = prompt("you a number from 1-3")
function game (person ){
if( myNum1 === person){
console.log("draw");
}
else if( myNum1 === 1 && person == 2){
console.log("person win");
}
else if( myNum1 === 1 && person == 3){
console.log("computer win");
}
else if( myNum1 === 2 && person == 1){
console.log("computer win");
}
else if( myNum1 === 2 && person == 3){
console.log("person win");
}
else if( myNum1 === 3 && person == 2){
console.log("computer win");
}
else if( myNum1 === 3 && person == 1){
console.log("person win");
}
};







123 changes: 92 additions & 31 deletions objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,95 @@

// Example format of an intern object: 1, examples@you.edu, Example, F
const example = {
id: 0,
name: "Example",
email: "examples@you.edu",
gender: "F",
}

// Write your intern objects here:


// ==== Challenge 2: Reading Object Data ====
// Once your objects are created, log out the following requests from HR into the console:

// Mitzi's name

// Kennan's ID

// Keven's email

// Gannie's name

// Antonietta's Gender

// ==== Challenge 3: Object Methods ====
// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
// console.log(kennan.speak());

// Antonietta loves math, give her the ability to multiply two numbers together and return the product. Use the console.log provided as a hint.
//console.log(antonietta.multiplyNums(3,4));

// === Great work! === Head over to the the arrays.js. You may come back and attempt the Stretch Challenge once you have completed the challenges in arrays.js and function-conversion.js.

id: 0,
name: "Example",
email: "examples@you.edu",
gender: "F",
}


// Write your intern objects here:
let person = {
id:1,
name: "mitzi",
email:"mmelloy0@psu.edu",
gender: "F"

}

let object = {
id: 2,
name: "Kennan",
email:"kdiben1@tinypic.com",
gender:"M"

}

let someone = {
id: 3,
name: "Keven",
email:"kmummery2@wikimedia.org",
gender:"M"

}
let poeple = {
id: 4,
name:"Gannie",
email:"gmartinson3@illinois.edu",
gender: "M",

}


let child = {
id: 5,
name:"Antonietta",
email:"adaine5@samsung.com",
gender: "F",
}





// ==== Challenge 2: Reading Object Data ====
// Once your objects are created, log out the following requests from HR into the console:

// Mitzi's name
console.log(person['name'])

// Kennan's ID
console.log(object["id"])


// Keven's email

console.log(someone['email'])

// Gannie's name

console.log(poeple['name'])

// Antonietta's Gender

console.log(child['gender'])

// ==== Challenge 3: Object Methods ====

// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
// console.log(kennan.speak());

let kennanspeak ={
speak:"hellow my name is kennan"
}
console.log(kennanspeak["speak"])

// Antonietta loves math, give her the ability to multiply two numbers together and return the product. Use the console.log provided as a hint.
//console.log(antonietta.multiplyNums(3,4));

let multiply =(num1, num2)=>{
return num1 * num2;
}
console.log(multiply(3,4))

// === Great work! === Head over to the the arrays.js. You may come back and attempt the Stretch Challenge once you have completed the challenges in arrays.js and function-conversion.js.