From 82fa0e85c588d78fc6778cd7e99f9ee8a9ee51b3 Mon Sep 17 00:00:00 2001 From: Jay Shailesh Prabhu Vadolkar <54521498+jayvadolkar@users.noreply.github.com> Date: Tue, 7 Jun 2022 16:24:59 +0530 Subject: [PATCH 1/2] Create func.js --- func.js | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 func.js diff --git a/func.js b/func.js new file mode 100644 index 0000000..a9e01fe --- /dev/null +++ b/func.js @@ -0,0 +1,92 @@ +function slice() { + const foods = ['pizza','burger','fingerChips','donuts','springRoll','Sandwich','HotDog','Pancake']; + var num1 = parseInt(document.getElementById("n1").value); + var num2 = parseInt(document.getElementById("n2").value); + var modifiedFood = []; + if(num1>=0 && num1<=7 && num2>=1 && num2<=8){ + for(let i=num1;i=0 && num1<=4){ + let i; + for(i=0;i value%2==0); + document.getElementById("out5").innerText = "evennumberArray = ["+res+"]"; + return res; +} + +function findSquare(){ + const myArray = [11, 34, 20, 5, 53, 16]; + let output = myArray.map(function(ele){ + return ele*ele; + }) + document.getElementById("out6").innerText = "SquareofArray = ["+output+"]"; + return output; +} + +function multiply(){ + const myArray = [2, 3, 5, 10]; + let mul = myArray.reduce(function(mul,ele){ + return mul*ele; + },1) + document.getElementById("out7").innerText = "Multiply Value = "+mul; + return mul; +} From 392b8ca38d06df46b1a18aa1c6a5df3e49cd15f0 Mon Sep 17 00:00:00 2001 From: Jay Shailesh Prabhu Vadolkar <54521498+jayvadolkar@users.noreply.github.com> Date: Tue, 7 Jun 2022 16:25:28 +0530 Subject: [PATCH 2/2] Create index.html --- index.html | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..87268a7 --- /dev/null +++ b/index.html @@ -0,0 +1,50 @@ + + + + + + + + Higher Order Function + + +

Function 1 : Array Slice()

+

const foods = [pizza, burger, fingerChips, donuts, springRoll, Sandwich, HotDog, Pancake]

+ + + +

+ +

Function 2 : Array Splice()

+

const foods = [pizza, burger, fingerChips, donuts, springRoll]

+ + + +

+ +

Function 3 : Filter()

+

const numberArray = [12,324,213,4,2,3,45,4234]

+ +

+ +

Function 4 : Reject()

+

const numberArray = [12,324,213,4,2,3,45,4234]

+ +

+ +

Function 5 : Lambda()

+

const numberArray = [12,324,213,4,2,3,45,4234]

+ +

+ +

Function 6 : Map()

+

const myArray = [11, 34, 20, 5, 53, 16]

+ +

+ +

Function 7 : Reduce()

+

const myArray = [2, 3, 5, 10]

+ +

+ +