课程: JavaScript: The Tricky Bits
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: bind() again
(upbeat music) - [Instructor] In this video, we're going to see how to pass additional parameters into callback functions. We'll be using the same bind method we've seen previously for setting the value of this and how it can do even more. I have the developer tools open on my example here. I can see I have these two buttons. If I click button one, an item is placed in column one, and if I click button two, same thing. You can do this until I get an error down here that I've run out of items, but I can see that the two buttons are doing exactly the same thing, where what I'd really like is for button one to place items in the first column and button two to place items in the second. Here in my editor, I could see my two buttons with the IDs one and two spelled out as a word. And then I have a slot, slot one and slot two, for the first and second column where those items will be placed. Now in my JavaScript file,…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
Pain point: Send extra parameters to an event handler2 分钟 47 秒
-
(已锁定)
Solution: bind() again7 分钟 6 秒
-
(已锁定)
Pain point: Function signature doesn’t accept arrays2 分钟 5 秒
-
(已锁定)
Solution: Function.prototype.apply()6 分钟 36 秒
-
(已锁定)
Pain point: Refactoring function signatures2 分钟 8 秒
-
(已锁定)
Solution: Objects for arguments6 分钟 34 秒
-
(已锁定)
Challenge: Story generator4 分钟 16 秒
-
(已锁定)
Solution overview: Story generator3 分钟 9 秒
-
(已锁定)
Solution walkthrough: Story generator8 分钟 37 秒
-
(已锁定)
-