From 27170d8e39195892b333603b3610ea487fc6513a Mon Sep 17 00:00:00 2001 From: Lance Hammond Jr Date: Thu, 26 Mar 2020 21:24:40 -0500 Subject: [PATCH 1/4] bDatatypesH --- 01week/datatypes.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/01week/datatypes.js b/01week/datatypes.js index e69de29bb..34e33eee1 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -0,0 +1,21 @@ +'use strict' + +//Write a JavaScript program to display the current day and time. +let now = Date(); +console.log("the current date and time", now); + +//Write a JavaScript program to convert a number to a string. +const theNumber = 5; +const theString = theNumber.toString(); + +console.log("The type of theSring varaible is", (typeof theString)) +console.log("The type of theNumber varaible is", (typeof theNumber)) +console.log("The syring is"); +console.log("The number is", theNumber); + + +//Write a JavaScript program to convert a string to the number. +const theOtherString = "11"; +const theOtherNumber = (theOtherString, 10); +console.log("The otherString type is", (typeof theOtherString)); +console.log("The otherNumber type is", (typeof theOtherNumber)); \ No newline at end of file From eab71b55b13813fb8bad2a4944f9e856f4b76c5a Mon Sep 17 00:00:00 2001 From: Lance Hammond Jr Date: Sun, 29 Mar 2020 11:52:33 -0500 Subject: [PATCH 2/4] rockPaperScissors --- 01week/rockPaperScissors.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index 72f0f1a89..605f3a30a 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -13,12 +13,28 @@ const rl = readline.createInterface({ // the function that will be called by the unit test below const rockPaperScissors = (hand1, hand2) => { - + hand1 = String.toLowercase() + hand2 = String.toLowercase() // Write code here // Use the unit test to see what is expected + if (hand1 === hand2){ + return "It's a tie!"; + } + + else if (hand1 === "rock" && hand2 === "paper"){ + if (hand1 === "paper" && hand2 === "scissors"); + else (hand1 === "scissors" && hand2 === "rock"); + return "Hand two wins!"; + } + else (hand1 === "paper" && hand2 === "rock"){ + if (hand1 === "rock" && hand2 === "scissors"); + else (hand1 === "scissors" && hand2 === "paper"); + return "Hand one wins!"; + }; } + // the first function called in the program to get an input from the user // to run the function use the command: node main.js // to close it ctrl + C From 83edde93cffffd60b7b178a02cbc00d40289ff45 Mon Sep 17 00:00:00 2001 From: Lance Hammond Jr Date: Sun, 29 Mar 2020 11:54:02 -0500 Subject: [PATCH 3/4] Conditionals --- 01week/Conditionals.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 01week/Conditionals.js diff --git a/01week/Conditionals.js b/01week/Conditionals.js new file mode 100644 index 000000000..4907dd833 --- /dev/null +++ b/01week/Conditionals.js @@ -0,0 +1,41 @@ +console.log("start program"); + +//write a fuction that takes in 3 variable +//and checks if they are all strings + + +function areStrings(thing1, thing2, thing3){ + // code to excute my logic + console.log("thing1 =", thing1); + console.log("thing2 =", thing2); + console.log("thing3 =", thing3); + + let type1 = typeof thing1; + let type2 = typeof thing2; + let type3 = typeof thing3; + + //if all 3 type are strings then print out "They are all strings" + if( + type1 === "string" && + type2 === "string" && + type3 === "string" + ){ + console.log("they are not all string"); + } + else{ + console.log("they are not all string"); + } +} + +areStrings( 4, "Lance", null) +console.log("end program"); + + +function isPassing(grade){ + if(grade >= 70){ + return true; + } + else{ + return false; + } +} \ No newline at end of file From f38593c77d0e7e1875ad5f76839e7ae887f9dfc0 Mon Sep 17 00:00:00 2001 From: Lance Hammond Jr Date: Tue, 31 Mar 2020 15:46:28 -0500 Subject: [PATCH 4/4] rockPaperScissors2 --- 01week/rockPaperScissors.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index 605f3a30a..eef831196 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -13,8 +13,9 @@ const rl = readline.createInterface({ // the function that will be called by the unit test below const rockPaperScissors = (hand1, hand2) => { - hand1 = String.toLowercase() - hand2 = String.toLowercase() + hand1 = hand1.toLowerCase() + hand2 = hand2.toLowerCase() + console.log(hand1) // Write code here // Use the unit test to see what is expected if (hand1 === hand2){ @@ -27,7 +28,7 @@ const rockPaperScissors = (hand1, hand2) => { return "Hand two wins!"; } - else (hand1 === "paper" && hand2 === "rock"){ + else if (hand1 === "paper" && hand2 === "rock"){ if (hand1 === "rock" && hand2 === "scissors"); else (hand1 === "scissors" && hand2 === "paper"); return "Hand one wins!";