From 3bbb1afe34936f6e60b24260f77a32e2553cde75 Mon Sep 17 00:00:00 2001
From: sgx-saksham
Date: Wed, 16 Feb 2022 15:21:35 +0530
Subject: [PATCH 1/2] Prograd ID : 8913
---
app.js | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
index.html | 22 +++++++++++++++
2 files changed, 100 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..32d5ba2
--- /dev/null
+++ b/app.js
@@ -0,0 +1,78 @@
+// Array
+const foods = ["pizza", "burger", "fingerShips", "donuts", "springRoll"];
+
+//#1 Array Slice
+function slice_food(foods,x,y)
+{
+var modifitem1 = foods.slice(x,y);
+console.log(modifitem1);
+}
+slice_food(foods,1,4);
+
+
+//#2: Array Splice
+function splice_food(foods,x,y)
+{
+ foods.splice(x,y,"noodles","icecream");
+ console.log(foods);
+}
+splice_food(foods,2,0);
+
+
+//#3: Filter
+const numberArray= [12,324,213,4,2,3,45,4234];
+ let isEven = (numberArray) => {
+ var even=numberArray.filter(item => {
+ return item % 2== 0;
+ });
+ console.log(even);
+};
+isEven(numberArray);
+ let prime = (numberArray) =>{
+ let p =numberArray.filter(data => {
+ for(var i=2;i<=Math.sqrt(data);i++)
+ {
+ if(data % i == 0)
+ {
+ return false;
+ }
+ }
+ return true;
+ });
+ console.log(p);
+};
+prime(numberArray);
+
+
+//#4: Reject
+function reject(numberArray)
+{
+ let nonprime = numberArray.filter((number) =>
+ {
+ for (var i = 2; i <= Math.sqrt(number); i++)
+ {
+ if (number % i == 0)
+ return true;
+ }
+ return false;
+ });
+ console.log(nonprime);
+}
+reject(numberArray);
+
+
+//#5: Lambda
+let e = numberArray.filter(data=> data % 2==0);
+console.log(e);
+
+
+//#6: Map
+const arr1 = [11, 34, 20, 5, 53, 16];
+var newarray =arr1.map(function(data){return data*data;});
+console.log(newarray);
+
+
+//#7: Reduce
+var myArray = [2, 3, 5, 10];
+var mul=myArray.reduce(function(i,d){return i*d;});
+console.log(mul);
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..4cf098a
--- /dev/null
+++ b/index.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ Higher Order Functions
+
+
+
+
+
+
+ Higher Order Functions
+
+
+ Open The Console
+ Created by Saksham Gupta, 19BCE10120, FED Squad 106
+
+
+
\ No newline at end of file
From 965eef938c70d2dbb84415d733f41b569dd04046 Mon Sep 17 00:00:00 2001
From: Saksham Gupta <66645082+sgx-saksham@users.noreply.github.com>
Date: Wed, 16 Feb 2022 15:27:41 +0530
Subject: [PATCH 2/2] Prograd ID : 8913
---
index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index 4cf098a..c9486e1 100644
--- a/index.html
+++ b/index.html
@@ -16,7 +16,7 @@
Open The Console
- Created by Saksham Gupta, 19BCE10120, FED Squad 106
+ Created by Saksham Gupta, 19BCE10129, FED Squad 106