课程: JavaScript: The Tricky Bits

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Solution: bind() again

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,…

内容