From c60157bf19a381d77352e5f1e2cc1d38def0c933 Mon Sep 17 00:00:00 2001 From: ssaumyaa7 <64359826+ssaumyaa7@users.noreply.github.com> Date: Thu, 1 Oct 2020 17:22:08 +0530 Subject: [PATCH 1/2] update day4 --- Day 04/Create a Rectangle Object.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Day 04/Create a Rectangle Object.js b/Day 04/Create a Rectangle Object.js index 081efdb..46a7e66 100644 --- a/Day 04/Create a Rectangle Object.js +++ b/Day 04/Create a Rectangle Object.js @@ -8,3 +8,13 @@ function Rectangle(a, b) { this.perimeter = 2 * (a + b); this.area = a * b; } +//method 2 +function Rectangle(a, b) { + const rec={ + length:a, + width:b, + perimeter:2*(a+b), + area:a*b + } + return rec +} From 70199a0fe462d8436d49204b4e850b4936ac6019 Mon Sep 17 00:00:00 2001 From: ssaumyaa7 <64359826+ssaumyaa7@users.noreply.github.com> Date: Thu, 1 Oct 2020 17:27:16 +0530 Subject: [PATCH 2/2] Update Count Objects.js --- Day 04/Count Objects.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Day 04/Count Objects.js b/Day 04/Count Objects.js index 2f076b8..3cdb86e 100644 --- a/Day 04/Count Objects.js +++ b/Day 04/Count Objects.js @@ -10,3 +10,11 @@ function getCount(objects) { return o.x == o.y; }).length; } +//method 2 +let c=0; +objects.forEach(function(i) { +if(i.x==i.y) + c++; +}) + return c +}