课程: JavaScript: The Tricky Bits
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Pain point: Function signature doesn’t accept arrays - JavaScript教程
课程: JavaScript: The Tricky Bits
Pain point: Function signature doesn’t accept arrays
- [Instructor] Every once in a while you might find a function whose method of invocation doesn't work with your needs but, otherwise, it's a match. In this video, we're trying an example of this, where we have an array of data, but the function we want to use only accepts individual parameters. A built-in example of this is the max method on the global math object, which returns the largest number from an argument list, but wouldn't work with an array of numbers like we have here. Let's look at another real example in the browser. I'm just going to click this go button, wait a few seconds. And then I get the results of some mocked up network requests inserted here into the page. Let's take a look at the code now. I have this promise simulator function that returns a promise that will resolve to the value I specify after a delay that I specify in milliseconds. This is much easier than trying to use a web server…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
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 秒
-
(已锁定)
-