-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcurrying.html
56 lines (53 loc) · 1.15 KB
/
currying.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Currying in JS</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
#wrapper{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
height: 100vh;
}
h1{
margin-bottom: 1rem;
font-size: 2.5rem;
}
p{
font-size: 1.5rem;
}
</style>
</head>
<body>
<div id="wrapper">
<h1>Currying in HTML</h1>
<p id="volume"></p>
</div>
<script>
//FUNCTION WITHOUT CURRYING
// const volume = (l,b,h) => {
// return l*b*h;
// }
// console.log(volume(2,4,6))
//FUNCTION WITH CURRYING
const volume = (l) => {
return (b) => {
return (h) => {
return h * b * l;
}
}
}
document.querySelector("p").innerHTML = volume(2)(4)(6);
</script>
</body>
</html>