We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 664c917 commit 0111bf7Copy full SHA for 0111bf7
12_LexicalScoping_and_closures/practicle.html
@@ -0,0 +1,22 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Document</title>
7
+</head>
8
+<body>
9
+ <button id="orange">Orange</button>
10
+ <button id="green">Green</button>
11
+</body>
12
+<script>
13
+ function clickHandler(color){
14
+ return function(){
15
+ document.body.style.backgroundColor = `${color}`
16
+ }
17
18
+
19
+ document.querySelector("#orange").onclick = clickHandler("orange")
20
+ document.querySelector("#green").onclick = clickHandler("green")
21
+</script>
22
+</html>
0 commit comments