From 22da1cec1dda1afd8802985c0b170af2df9641fd Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:02:53 +0530
Subject: [PATCH 01/27] Exercise 1.2
---
Chapter 1/Exercise 1.2 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 Chapter 1/Exercise 1.2
diff --git a/Chapter 1/Exercise 1.2 b/Chapter 1/Exercise 1.2
new file mode 100644
index 0000000..90d4616
--- /dev/null
+++ b/Chapter 1/Exercise 1.2
@@ -0,0 +1,14 @@
+
+
+
+
+ Tester
+
+
+
+
+
+
+
From 27a56d3315c90c9401c8660486fe84b0946ba1b0 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:03:41 +0530
Subject: [PATCH 02/27] Exercise 1.3
---
Chapter 1/Exercise 1.3 | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 Chapter 1/Exercise 1.3
diff --git a/Chapter 1/Exercise 1.3 b/Chapter 1/Exercise 1.3
new file mode 100644
index 0000000..6fd5f5b
--- /dev/null
+++ b/Chapter 1/Exercise 1.3
@@ -0,0 +1,12 @@
+
+
+
+
+ Tester
+
+
+
+
+
+
+
From c5478d1d95ff0005b538b3e01781aa47caaa5874 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:05:04 +0530
Subject: [PATCH 03/27] Exercise 1.4
---
Chapter 1/Exercise 1.4 | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 Chapter 1/Exercise 1.4
diff --git a/Chapter 1/Exercise 1.4 b/Chapter 1/Exercise 1.4
new file mode 100644
index 0000000..02ba2dc
--- /dev/null
+++ b/Chapter 1/Exercise 1.4
@@ -0,0 +1,3 @@
+let a = 10; // assign a value of 10 to variable a
+console.log(a); // This will output 10 into the console
+/*
From 4ebd20eb4df36e0f470163463e23baccfc133530 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:06:18 +0530
Subject: [PATCH 04/27] Project 1
---
Chapter 1/Project 1 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 Chapter 1/Project 1
diff --git a/Chapter 1/Project 1 b/Chapter 1/Project 1
new file mode 100644
index 0000000..0c8bcee
--- /dev/null
+++ b/Chapter 1/Project 1
@@ -0,0 +1,15 @@
+
+
+
+ JS Tester
+
+
+
+
+
+
+// console.log("Laurence");
+/*
+This is my comment
+Laurence Svekis
+*/
From 6a5e8a50f91557b7ae1a4e7cb74033e3cabf43ac Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:06:43 +0530
Subject: [PATCH 05/27] Update Exercise 1.4
---
Chapter 1/Exercise 1.4 | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Chapter 1/Exercise 1.4 b/Chapter 1/Exercise 1.4
index 02ba2dc..4343628 100644
--- a/Chapter 1/Exercise 1.4
+++ b/Chapter 1/Exercise 1.4
@@ -1,3 +1,7 @@
let a = 10; // assign a value of 10 to variable a
console.log(a); // This will output 10 into the console
/*
+This is a multi-line
+Comment
+*/
+
From 2345bceda065738ff4b7324515ce6add954668f8 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:07:15 +0530
Subject: [PATCH 06/27] Exercise 1.4
---
Chapter 1/Exercise 1.4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Chapter 1/Exercise 1.4 b/Chapter 1/Exercise 1.4
index 4343628..9dfe78f 100644
--- a/Chapter 1/Exercise 1.4
+++ b/Chapter 1/Exercise 1.4
@@ -1,7 +1,7 @@
let a = 10; // assign a value of 10 to variable a
console.log(a); // This will output 10 into the console
/*
-This is a multi-line
+This is a multi-line
Comment
*/
From ce07cc4288459a450784268d552d00b8bfea9afc Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:09:07 +0530
Subject: [PATCH 07/27] Exercise 2.1
---
Chapter 2/Exercise 2.1 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/Chapter 2/Exercise 2.1 b/Chapter 2/Exercise 2.1
index 8b13789..1f0ea10 100644
--- a/Chapter 2/Exercise 2.1
+++ b/Chapter 2/Exercise 2.1
@@ -1 +1,13 @@
+let str1 = 'Laurence';
+let str2 = "Svekis";
+let val1 = undefined;
+let val2 = null;
+let myNum = 1000;
+
+
+console.log(typeof(str1));
+console.log(typeof(str2));
+console.log(typeof(val1));
+console.log(typeof(val2));
+console.log(typeof(myNum));
From 19697d0397d77aae6dc2131c2130e64c60d0c7c9 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:13:19 +0530
Subject: [PATCH 08/27] Exercise 2.2
---
Chapter 2/Exercise 2.2 | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 Chapter 2/Exercise 2.2
diff --git a/Chapter 2/Exercise 2.2 b/Chapter 2/Exercise 2.2
new file mode 100644
index 0000000..b23f19b
--- /dev/null
+++ b/Chapter 2/Exercise 2.2
@@ -0,0 +1,5 @@
+const myName = "Maaike";
+const myAge = 29;
+const coder = true;
+const message = "Hello, my name is " + myName + ", I am " + myAge+" years old and I can code JavaScript: " + coder + ".";
+console.log(message);
From e315c2e95b64c1dd5897909d1840253c59b35da5 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:13:56 +0530
Subject: [PATCH 09/27] Exercise 2.3
---
Chapter 2/Exercise 2.3 | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 Chapter 2/Exercise 2.3
diff --git a/Chapter 2/Exercise 2.3 b/Chapter 2/Exercise 2.3
new file mode 100644
index 0000000..4828514
--- /dev/null
+++ b/Chapter 2/Exercise 2.3
@@ -0,0 +1,6 @@
+let a = window.prompt("Value 1?");
+let b = window.prompt("Value 2?");
+a = Number(a);
+b = Number(b);
+let hypotenuseVal = ((a * a) + (b * b))**0.5;
+console.log(hypotenuseVal);
From 49dea4f4e542da160112dfc15453381d4b719575 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:16:01 +0530
Subject: [PATCH 10/27] Exercise 2.4
---
Chapter 2/Exercise 2.4 | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 Chapter 2/Exercise 2.4
diff --git a/Chapter 2/Exercise 2.4 b/Chapter 2/Exercise 2.4
new file mode 100644
index 0000000..2e78578
--- /dev/null
+++ b/Chapter 2/Exercise 2.4
@@ -0,0 +1,7 @@
+let a = 4;
+let b = 11;
+let c = 21;
+a = a + b;
+a = a / c;
+c = c % b;
+console.log(a, b, c);
From fd7ccde5789b212d791e1523e7cebf845ad8d209 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:16:40 +0530
Subject: [PATCH 11/27] Project 1
---
Chapter 2/Project 1 | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 Chapter 2/Project 1
diff --git a/Chapter 2/Project 1 b/Chapter 2/Project 1
new file mode 100644
index 0000000..1d707a6
--- /dev/null
+++ b/Chapter 2/Project 1
@@ -0,0 +1,5 @@
+//Convert miles to kilometers.
+//1 mile equals 1.60934 kilometers.
+let myDistanceMiles = 130;
+let myDistanceKM = myDistanceMiles * 1.60934;
+console.log("The distance of " + myDistanceMiles + " miles is equal to " + myDistanceKM + " kilometers")
From 0aa61dee585516952c78116c81a4cf681a582155 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:17:08 +0530
Subject: [PATCH 12/27] Project 2
---
Chapter 2/Project 2 | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 Chapter 2/Project 2
diff --git a/Chapter 2/Project 2 b/Chapter 2/Project 2
new file mode 100644
index 0000000..507805a
--- /dev/null
+++ b/Chapter 2/Project 2
@@ -0,0 +1,9 @@
+//1 inch = 2.54 centimetres.
+//2.2046 pounds in a kilo
+let inches = 72;
+let pounds = 180;
+let weight = pounds / 2.2046; // in kilos
+let height = inches * 2.54; // height in centimetres
+console.log(weight, height);
+let bmi = weight/(height/100*height/100);
+console.log(bmi);
From 4cca272289d1b68954e05855ced1b79d9f0d3ced Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:18:36 +0530
Subject: [PATCH 13/27] Exercise 3.1
---
Chapter 3/Exercise 3.1 | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 Chapter 3/Exercise 3.1
diff --git a/Chapter 3/Exercise 3.1 b/Chapter 3/Exercise 3.1
new file mode 100644
index 0000000..4e976b8
--- /dev/null
+++ b/Chapter 3/Exercise 3.1
@@ -0,0 +1,4 @@
+const myList = ["Milk", "Bread", "Apples"];
+console.log(myList.length);
+myList[1] = "Bananas";
+console.log(myList);
From 3a5b27352054fc09c426eab67a54089af7bf4cc1 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:19:10 +0530
Subject: [PATCH 14/27] Exercise 3.2
---
Chapter 3/Exercise 3.2 | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 Chapter 3/Exercise 3.2
diff --git a/Chapter 3/Exercise 3.2 b/Chapter 3/Exercise 3.2
new file mode 100644
index 0000000..5d09742
--- /dev/null
+++ b/Chapter 3/Exercise 3.2
@@ -0,0 +1,12 @@
+const myList = [];
+myList.push("Milk", "Bread", "Apples");
+myList.splice(1, 1, "Bananas", "Eggs");
+const removeLast = myList.pop();
+console.log(removeLast);
+myList.sort();
+console.log(myList.indexOf("Milk"));
+myList.splice(1, 0, "Carrots", "Lettuce");
+const myList2 = ["Juice", "Pop"];
+const finalList = myList.concat(myList2, myList2);
+console.log(finalList.lastIndexOf("Pop"));
+console.log(finalList);
From f899c8a30efbea68de3b1d9e8f5581f4af80cab6 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:19:38 +0530
Subject: [PATCH 15/27] Exercise 3.3
---
Chapter 3/Exercise 3.3 | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 Chapter 3/Exercise 3.3
diff --git a/Chapter 3/Exercise 3.3 b/Chapter 3/Exercise 3.3
new file mode 100644
index 0000000..2c5c49e
--- /dev/null
+++ b/Chapter 3/Exercise 3.3
@@ -0,0 +1,5 @@
+const myArr = [1, 2, 3];
+const bigArr = [myArr, myArr, myArr];
+console.log(bigArr[1][1]);
+console.log(bigArr[0][1]);
+console.log(bigArr[2][1]);
From 8a84d58b5972bc826931df7fffabc850dd65af9c Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:20:06 +0530
Subject: [PATCH 16/27] Exercise 3.4
---
Chapter 3/Exercise 3.4 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 Chapter 3/Exercise 3.4
diff --git a/Chapter 3/Exercise 3.4 b/Chapter 3/Exercise 3.4
new file mode 100644
index 0000000..fec4127
--- /dev/null
+++ b/Chapter 3/Exercise 3.4
@@ -0,0 +1,15 @@
+const myCar = {
+ make: "Toyota",
+ model: "Camry",
+ tires: 4,
+ doors: 4,
+ color: "blue",
+ forSale: false
+};
+
+let propColor = "color";
+myCar[propColor] = "red";
+propColor = "forSale";
+myCar[propColor] = true;
+console.log(myCar.make + " " + myCar.model);
+console.log(myCar.forSale);
From a44c58506c98b06e73fb02c3c086453ed3aa179d Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:20:44 +0530
Subject: [PATCH 17/27] Exercise 3.5
---
Chapter 3/Exercise 3.5 | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 Chapter 3/Exercise 3.5
diff --git a/Chapter 3/Exercise 3.5 b/Chapter 3/Exercise 3.5
new file mode 100644
index 0000000..ffde2ce
--- /dev/null
+++ b/Chapter 3/Exercise 3.5
@@ -0,0 +1,6 @@
+const people = {friends:[]};
+const friend1 = {first: "Laurence", last: "Svekis", id: 1};
+const friend2 = {first: "Jane", last: "Doe", id: 2};
+const friend3 = {first: "John", last: "Doe", id: 3};
+people.friends.push(friend1, friend2, friend3);
+console.log(people);
From fc29cedd300e28b053d6dfc32e2d02702c7b455d Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:21:30 +0530
Subject: [PATCH 18/27] Project 1
---
Chapter 3/Project 1 | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 Chapter 3/Project 1
diff --git a/Chapter 3/Project 1 b/Chapter 3/Project 1
new file mode 100644
index 0000000..20600fb
--- /dev/null
+++ b/Chapter 3/Project 1
@@ -0,0 +1,7 @@
+theList.pop();
+theList.shift();
+theList.unshift("FIRST");
+theList[3] = "hello World";
+theList[2] = "MIDDLE";
+theList.push("LAST");
+console.log(theList);
From d779c4208d0668d524ef8a50c166a14f62cab89a Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:22:11 +0530
Subject: [PATCH 19/27] Project 2
---
Chapter 3/Project 2 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 Chapter 3/Project 2
diff --git a/Chapter 3/Project 2 b/Chapter 3/Project 2
new file mode 100644
index 0000000..3bf6d48
--- /dev/null
+++ b/Chapter 3/Project 2
@@ -0,0 +1,22 @@
+const inventory = [];
+const item3 = {
+ name: "computer",
+ model: "imac",
+ cost: 1000,
+ qty: 3
+}
+const item2 = {
+ name: "phone",
+ model: "android",
+ cost: 500,
+ qty: 11
+}
+const item1 = {
+ name: "tablet",
+ model: "ipad",
+ cost: 650,
+ qty: 1
+}
+inventory.push(item1, item2, item3);
+console.log(inventory);
+console.log(inventory[2].qty);
From 5328f7f951afe42a726863c8f620781f98b1a978 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:26:54 +0530
Subject: [PATCH 20/27] Exercise 4.1
---
Chapter 4/Exercise 4.1 | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 Chapter 4/Exercise 4.1
diff --git a/Chapter 4/Exercise 4.1 b/Chapter 4/Exercise 4.1
new file mode 100644
index 0000000..28dc50c
--- /dev/null
+++ b/Chapter 4/Exercise 4.1
@@ -0,0 +1,8 @@
+const test = false;
+console.log(test);
+if(test){
+ console.log("It's True");
+}
+if(!test){
+ console.log("False now");
+}
From 605c8c91da2efe6407e914203ab88964e76bae82 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:27:27 +0530
Subject: [PATCH 21/27] Exercise 4.2
---
Chapter 4/Exercise 4.2 | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 Chapter 4/Exercise 4.2
diff --git a/Chapter 4/Exercise 4.2 b/Chapter 4/Exercise 4.2
new file mode 100644
index 0000000..6b4a0c2
--- /dev/null
+++ b/Chapter 4/Exercise 4.2
@@ -0,0 +1,11 @@
+let age = prompt("How old are you?");
+age = Number(age);
+let message;
+if(age >= 21){
+ message = "You can enter and drink.";
+}else if(age >= 19){
+ message = "You can enter but not drink.";
+}else{
+ message = "You are not allowed in!";
+}
+console.log(message);
From 2e15a2b493d8fa784ecc51211a2e2eaf46c021b8 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:28:01 +0530
Subject: [PATCH 22/27] Exercise 4.3
---
Chapter 4/Exercise 4.3 | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 Chapter 4/Exercise 4.3
diff --git a/Chapter 4/Exercise 4.3 b/Chapter 4/Exercise 4.3
new file mode 100644
index 0000000..e450dc8
--- /dev/null
+++ b/Chapter 4/Exercise 4.3
@@ -0,0 +1,3 @@
+const id = true;
+const message = (id) ? "Allowed In" : "Denied Entry";
+console.log(message);
From 83d144661288fdf0e72684544f555ac8e418f4f0 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:28:37 +0530
Subject: [PATCH 23/27] Exercise 4.4
---
Chapter 4/Exercise 4.4 | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 Chapter 4/Exercise 4.4
diff --git a/Chapter 4/Exercise 4.4 b/Chapter 4/Exercise 4.4
new file mode 100644
index 0000000..4de299f
--- /dev/null
+++ b/Chapter 4/Exercise 4.4
@@ -0,0 +1,21 @@
+const randomNumber = Math.floor(Math.random() * 6);
+let answer = "Something went wrong";
+let question = prompt("Ask me anything");
+switch (randomNumber) {
+ case 0:
+ answer = "It will work out";
+ break;
+ case 1:
+ answer = "Maybe, maybe not";
+ break;
+ case 2:
+ answer = "Probably not";
+ break;
+ case 3:
+ answer = "Highly likely";
+ break;
+ default:
+ answer = "I don't know about that";
+}
+let output = "You asked me " + question + ". I think that " + answer;
+console.log(output);
From 49c6b969b30857623fac0618066cd7fc2fd035ba Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:29:04 +0530
Subject: [PATCH 24/27] Exercise 4.5
---
Chapter 4/Exercise 4.5 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 Chapter 4/Exercise 4.5
diff --git a/Chapter 4/Exercise 4.5 b/Chapter 4/Exercise 4.5
new file mode 100644
index 0000000..444e180
--- /dev/null
+++ b/Chapter 4/Exercise 4.5
@@ -0,0 +1,22 @@
+let prize = prompt("Pick a number 0-10");
+prize = Number(prize);
+let output = "My Selection: ";
+switch (prize){
+ case 0:
+ output += "Gold ";
+ case 1:
+ output += "Coin ";
+ break;
+ case 2:
+ output += "Big ";
+ case 3:
+ output += "Box of ";
+ case 4:
+ output += "Silver ";
+ case 5:
+ output += "Bricks ";
+ break;
+ default:
+ output += "Sorry Try Again";
+}
+console.log(output);
From 49d09c949b8aea0f17070fb9ccd9c25821b24963 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:29:35 +0530
Subject: [PATCH 25/27] Project 1
---
Chapter 4/Project 1 | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 Chapter 4/Project 1
diff --git a/Chapter 4/Project 1 b/Chapter 4/Project 1
new file mode 100644
index 0000000..f766b6c
--- /dev/null
+++ b/Chapter 4/Project 1
@@ -0,0 +1,13 @@
+let val = prompt("What number?");
+val = Number(val);
+let num = 100;
+let message = "nothing";
+if (val > num) {
+ message = val + " was greater than " + num;
+} else if (val === num) {
+ message = val + " was equal to " + num;
+} else {
+ message = val + " is less than " + num;
+}
+console.log(message);
+console.log(message);
From 6b940795e53cb177991045c9c30415d2445761bf Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:29:59 +0530
Subject: [PATCH 26/27] Project 2
---
Chapter 4/Project 2 | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 Chapter 4/Project 2
diff --git a/Chapter 4/Project 2 b/Chapter 4/Project 2
new file mode 100644
index 0000000..561c6c5
--- /dev/null
+++ b/Chapter 4/Project 2
@@ -0,0 +1,13 @@
+let person = prompt("Enter a name");
+let message;
+switch (person) {
+ case "John" :
+ case "Larry" :
+ case "Jane" :
+ case "Laurence" :
+ message = person + " is my friend";
+ break;
+ default :
+ message = "I don't know " + person;
+}
+console.log(message);
From 09d27448f1beac3acae2f5fd7e2bc4363d939695 Mon Sep 17 00:00:00 2001
From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com>
Date: Wed, 24 Nov 2021 19:30:38 +0530
Subject: [PATCH 27/27] Project 3
---
Chapter 4/Project 3 | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 Chapter 4/Project 3
diff --git a/Chapter 4/Project 3 b/Chapter 4/Project 3
new file mode 100644
index 0000000..fd92cb2
--- /dev/null
+++ b/Chapter 4/Project 3
@@ -0,0 +1,20 @@
+const myArr = ["Rock", "Paper", "Scissors"];
+let computer = Math.floor(Math.random() * 3);
+let player = Math.floor(Math.random() * 3);
+let message = "player " + myArr[player] + " vs computer " + myArr[computer] + " ";
+if (player === computer) {
+message += "it's a tie";
+} else if (player > computer) {
+if (computer == 0 && player == 2) {
+message += "Computer Wins";
+} else {
+message += "Player Wins";
+}
+} else {
+if (computer == 2 && player == 0) {
+message += "Player Wins";
+} else {
+message += "Computer Wins";
+}
+}
+console.log(message);