今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Implementing stacks and queues 2
(bright music) - [Instructor] In this challenge, we're given an array of months, and we need to add January to the beginning of that array. So for this particular challenge, we're going to reach for the array method, unshift. So just as we did in the previous one with push, we're going to start with our months array, and we're going to unshift. So use that method, and then we're going to pass the string January, oops. And make sure that we spell that correctly. And as I've said many, many times, make sure that your casing matches, because we're going to need to then return this, and check it to make sure that it's the correct solution. So return months. All right, and then let's go ahead and test it. And awesome, we got the correct answer. You can see January has been added to the beginning of the months array. Great job.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。