今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Dynamic colors
(video game music) - Closures are functions that close over their lexical environment or their scope. This allows us to access an outer function scope from an inner function. We use closures in many different places. For example, if we're filtering an array of items or if we're creating a new timeout. In this challenge we'll use closures to create three buttons. Each button will represent a different color and we'll change the background color of the document body to the color value. Using a closure, create a function called changeColor that accepts a color value. When the button is clicked, the closure should be invoked and the body background color should be updated. Pause the video here and develop your solution, and when you're ready, come back and I'll walk you through how I solve the challenge. (video game music) Here we have three buttons. Each button has an ID with the name of a color. Let's walk through the…
内容
-
-
-
Available books6 分钟 11 秒
-
(已锁定)
Movie object5 分钟 29 秒
-
(已锁定)
Vegetarian dinner3 分钟 11 秒
-
(已锁定)
Technical books2 分钟 33 秒
-
(已锁定)
Private object2 分钟 13 秒
-
(已锁定)
Ticking time2 分钟 17 秒
-
(已锁定)
Classroom attendance3 分钟 14 秒
-
(已锁定)
Dynamic colors4 分钟 15 秒
-
(已锁定)
Coffee calculations3 分钟 21 秒
-
(已锁定)
Food truck3 分钟 4 秒
-
(已锁定)
Train generator3 分钟 31 秒
-
(已锁定)
String permutation3 分钟 11 秒
-
(已锁定)
Five friends3 分钟 43 秒
-
(已锁定)
URLify3 分钟 55 秒
-
(已锁定)
Password strength4 分钟 58 秒
-