今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Implementing stacks and queues 1
(light upbeat music) - [Instructor] Welcome back. In this particular challenge, we've been given an array of scores, and we need to add a score of 7 to the end of this existing scores array. So for this particular challenge, we're going to reach for a very common array method that you're going to find yourself using time and time again. And that is the array method push. So the first thing that we'll need to do is reference our array, scores, and then push, and then you're going to pass the value that you need added to the end of the array. So, in this case, that's 7. Now, in order to check our solution after we've added 7 to the array, let's then return it, scores, and check. All right, let's go ahead and test that. And awesome. You can see that your scores array is now 10, 9, 8, 7, exactly as it should be. Great work.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。