课程: JavaScript: The Tricky Bits
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Pain point: Send extra parameters to an event handler - JavaScript教程
课程: JavaScript: The Tricky Bits
Pain point: Send extra parameters to an event handler
- [Joe] This section is roughly grouped under the heading of functions, starting with this video where we're looking at event handlers and other functions where there's an expected parameter or set of parameters. Is it possible to add to those parameters, and if so, how? If you've written anything JavaScript for the web, you've surely written an event handler like this countless times. You pass the event object if needed inside the function. And if you need other contexts, it comes from variables to find outside the function. The same logic generally applies to other uses of callback functions like timers, promises, and AJAX requests. There's usually some known parameters passed in and that's it, or at least that's how it appears. This can start to feel limiting when your callback function could use a little more context that isn't immediately available. It can be especially tricky when you're depending on external…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
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 秒
-
(已锁定)
-