diff --git a/arrays.js b/arrays.js index 9a5827f..3a9e7ee 100644 --- a/arrays.js +++ b/arrays.js @@ -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 { + 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 @@ -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"); + } +}; + + + + + + + diff --git a/objects.js b/objects.js index 9640e8c..202f6d7 100644 --- a/objects.js +++ b/objects.js @@ -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. - \ No newline at end of file + 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.