From 6f01a3c8e6eeae495c781b935c1767f5138c876c Mon Sep 17 00:00:00 2001
From: Mounish Polisetti
Date: Sat, 19 Mar 2022 21:02:20 +0530
Subject: [PATCH 1/3] new
---
app.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
index.html | 22 +++++++++++++++++
2 files changed, 93 insertions(+)
create mode 100644 app.js
create mode 100644 index.html
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..fd0d398
--- /dev/null
+++ b/app.js
@@ -0,0 +1,71 @@
+// Function #1: Array Slice;
+const foods = ["pizza", "burger", "fingerChips", "donuts", "springRoll"];
+const modifiedFood = foods.slice(
+ foods.indexOf("pizza") + 1,
+ foods.indexOf("springRoll")
+);
+console.log(modifiedFood);
+
+//function #2: Array Spliceconst
+var foods1 = ["pizza", "burger", "fingerChips", "donuts", "springRoll"];
+var modifiedFood1 = foods1.splice(2, 0, "noodles", "icecream");
+console.log(foods1);
+
+//Function #3: Filter
+const numberArray = [12, 324, 213, 4, 2, 3, 45, 4234];
+
+function isEvan(numberArray) {
+ return numberArray.filter(function (number) {
+ if (number % 2 === 0) {
+ return number;
+ }
+ });
+}
+
+var evenNumbers = isEvan(numberArray);
+console.log(evenNumbers);
+
+function isPrime(numberArray) {
+ return numberArray.filter((number) => {
+ for (var i = 2; i <= Math.sqrt(number); i++) {
+ if (number % i === 0) return false;
+ }
+ return true;
+ });
+}
+
+var primeNumbers = isPrime(numberArray);
+console.log(primeNumbers);
+
+//Function #4: Reject
+
+var reject = {};
+//Function #5: Lambda function
+var evenNumbers1 = numberArray.filter((number) => {
+ if (number % 2 == 0) return number;
+});
+console.log(evenNumbers1);
+
+//Function #6: Map
+
+const myArray = [11, 34, 20, 5, 53, 16];
+
+function findSquareOfNumbers(myArray) {
+ return myArray.map(function (number) {
+ return number * number;
+ });
+}
+
+var SquareOfNumbers = findSquareOfNumbers(myArray);
+console.log(SquareOfNumbers);
+
+//Function #7: Reduce
+
+const myArray1 = [2, 3, 5, 10];
+
+function multiply(myArray1) {
+ return myArray1.reduce((a, b) => a * b, 1);
+}
+
+var multiplication = multiply(myArray1);
+console.log(multiplication);
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..1216e80
--- /dev/null
+++ b/index.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ Higher Order Functions
+
+
+
+
+
+
+ Higher Order Functions
+
+
+ Created by -
Annika Chandra - 19BCE10049
Squad -
+ 106
+ ProGrad ❤️
+
+
+
\ No newline at end of file
From ecd7f76750b497548741755380714629c45ebf2c Mon Sep 17 00:00:00 2001
From: Mounish Polisetti <85478542+Mounish-Polisetti@users.noreply.github.com>
Date: Sat, 19 Mar 2022 21:46:30 +0530
Subject: [PATCH 2/3] Update index.html
---
index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index 1216e80..515502e 100644
--- a/index.html
+++ b/index.html
@@ -14,9 +14,9 @@
Higher Order Functions
- Created by -
Annika Chandra - 19BCE10049
Squad -
+ Created by -
Mounish Polisetti - 19BCE10049
Squad -
106
ProGrad ❤️