今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Navigating through solutions
- [Instructor] All right, so the last thing we need to do is make sure that these buttons allow us to advance and move back through our solutions. So to do that I'm going to move right here and do some ducument queryselector queries. We'll do the Previous button first. And we will add an event listener. Of course we're gonna be looking for a click. And then call a function that will pass along an event. We'll decrement the current solution and then if the solution is less than one, so if we click and it's already at the first position we will reset it so that it's at the index of the last position. Minus one because arrays are zero indexed, so this means the last one. And it looks like I need a parentheses right there. All right, so then we will need to clear the board with the clear the board function we created earlier and then we will need to actually load up the new board. And then finally we'll display the current solution here. All right, so let's see if that works. If we click…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
Intro: Eight queens1 分钟 45 秒
-
(已锁定)
Solution overview1 分钟 31 秒
-
(已锁定)
Preparing the board6 分钟 46 秒
-
(已锁定)
Setting up the board4 分钟 17 秒
-
(已锁定)
Computing solutions3 分钟 56 秒
-
(已锁定)
Finishing calculations7 分钟 23 秒
-
(已锁定)
Storing board solutions4 分钟 1 秒
-
(已锁定)
Display solutions4 分钟 7 秒
-
(已锁定)
Navigating through solutions3 分钟 32 秒
-
(已锁定)
-
-
-