diff --git a/basics.js b/basics.js index 8036dce..7db7169 100644 --- a/basics.js +++ b/basics.js @@ -10,6 +10,12 @@ Do the following: */ + +const str = '1999' +let numper = parseInt(str) +console.log(numper) + + /* Task: Mood Checker @@ -21,6 +27,14 @@ Do the following: */ +let user = prompt("how is your situation") + +if(user === "hppy"){ + alert("Yay me too!'") +} else { + alert("Aw cheer up!'") +} + /* Task: Odd or Even / kisi ama dhaban @@ -94,6 +108,24 @@ 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); + } + } + } + + // Call the fizzBuzz function to run the program + fizzBuzz(); /*💪💪💪💪💪💪💪💪💪💪 Stretch 💪💪💪💪💪💪💪💪💪💪*/ //Vowel Counter - How many vowels are there? diff --git a/functions.js b/functions.js index e88aca4..0645aeb 100644 --- a/functions.js +++ b/functions.js @@ -3,6 +3,35 @@ // Take the commented ES5 syntax and convert it to ES6 arrow Syntax +const myfunction = ()=> { + console.log("Function was invoked!"); + + +} + +myfunction() + + + + + +let anotherFunction = (numper,item)=> { + + console.log(numper , item) + + +} +anotherFunction(3,6) + + + + +let add = (param1, param2) => { + return param1 + param2; +}; + +console.log(add(8,10)) + /* ------------ diff --git a/objects.js b/objects.js index 9640e8c..2f76d83 100644 --- a/objects.js +++ b/objects.js @@ -41,4 +41,51 @@ const example = { //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 + + + const intern1 = { + id: 1, + email: "mmelloy0@psu.edu", + firstName: "Mitzi", + gender: "F" + }; + + const intern2 = { + id: 2, + email: "kdiben1@tinypic.com", + firstName: "Kennan", + gender: "M" + }; + + const intern3 = { + id: 3, + email: "kmummery2@wikimedia.org", + firstName: "Keven", + gender: "M" + }; + + const intern4 = { + id: 4, + email: "gmartinson3@illinois.edu", + firstName: "Gannie", + gender: "M" + }; + + const intern5 = { + id: 5, + email: "adaine5@samsung.com", + firstName: "Antonietta", + gender: "F" + }; + + + intern2.speak = function() { + return "Hello, my name is " + this.firstName + "!"; + }; + + intern5.multiplyNums = function(num1, num2) { + return num1 * num2; + }; + + console.log(intern2.speak()); // "Hello, my name is Kennan!" + console.log(intern5.multiplyNums(3, 4)); // 12 \ No newline at end of file