Compare commits

...

6 Commits

Author SHA1 Message Date
jason.zhu c38c66a446 Module1: How Closures Work 2021-05-12 11:45:47 +10:00
jason.zhu c11b998681 Module 1: Understanding Block Scope 2021-05-12 11:41:40 +10:00
jason.zhu cfc610bf1a Module 1: Understanding Function Scope 2021-05-12 11:39:16 +10:00
jason.zhu bd562c63a2 Module 1: Introducing Functions 2021-05-12 11:36:07 +10:00
jason.zhu 4f0a3819c4 Modified README.md 2021-05-12 11:35:16 +10:00
jason.zhu cdbfc9f1a1 Added app.js, index.html 2021-05-11 10:24:54 +10:00
3 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# README
This is a practice repo following [JavaScript: Functions](https://app.pluralsight.com/course-player?clipId=bdda4158-f634-4866-ac1a-f536f948c3e1)

12
app.js 100644
View File

@ -0,0 +1,12 @@
function setupCounter(val) {
return function counter() {
return val++;
}
}
let counter1 = setupCounter(0);
console.log(counter1());
console.log(counter1());
let counter2 = setupCounter(10);
console.log(counter2());
console.log(counter2());

14
index.html 100644
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JavaScript Demo</title>
</head>
<body>
<h1>JavaScript Demo</h1>
<script src="app.js"></script>
</body>
</html>