In this exercise, you must turn the mult() function into a recursive function that can work on as many arguments as necessary.
- Exercise three, let's pull up exercise three.…Do a tad bit of experimentation with our understanding…of recursion.…Exercise three.…Take mult which is already defined,…turn it in a recursive function that can work on…as many arguments as necessary.…So how is mult currently defined?…It only works with three parameters x, y, and z.…
Line seven would create a problem for us…because it's still going to return 60 instead of 360…the way we expect.…You could do this iteratively with a four loop…and if that helps you, turn it first…into an iterative solution, if that helps,…but the exercise here is to ask yourself…what is the multiplication of all these arguments?…And by the way it's going to look an awful lot…like that last slide that we just looked at.…
This course was created by Frontend Masters. It was originally released on 03/08/2016. We're pleased to host this training in our library.
- Pure functions
- Manual composition
- Composition utility
- List operations
Skill Level Intermediate
1. Pure Functions
2. Composition and Immutability
3. Closure and Recursion
4. List Operations
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.