Skip to content

Commit 030f47b

Browse files
committed
ES6 arrow function example
1 parent a183471 commit 030f47b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

chapter01/13-ES6ArrowFunctions.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title></title>
6+
</head>
7+
<body>
8+
<script type="text/javascript" src="13-ES6ArrowFunctions.js"></script>
9+
10+
</body>
11+
</html>

chapter01/13-ES6ArrowFunctions.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//ES6: arrow functions
2+
let circleArea = (r) => {
3+
const PI = 3.14;
4+
let area = PI * r * r;
5+
return area;
6+
}
7+
console.log(circleArea(2));
8+
9+
let circleArea2 = (r) => 3.14 * r * r;
10+
console.log(circleArea2(2));

0 commit comments

Comments
 (0)