Check out a free preview of the full Go for JavaScript Developers course:
The "Methods Exercise" Lesson is part of the full, Go for JavaScript Developers course featured in this preview video. Here's what you'd learn in this lesson:

Students are instructed to refactor functions from earlier in the course to be methods, and modify the main function to accept these methods.

Get Unlimited Access Now

Transcript from the "Methods Exercise" Lesson

>> Okay, for exercise 9A, we're gonna practice implementing the describe group or refactoring the describeGroup function as a method. So I'm gonna hop over to exercise_9A.markdown in the methods section. So the goal here is just practice writing a method and refactoring an existing function into a method. And to get things going, if you look in the code directory and methods.go, I've copied over the solution that we worked through from the struct section yesterday.

[00:00:29] Which has all of the starting functions for both the user struct and group. So you can start with that code and then build off of it. You're gonna have to refactor the scribe user code, which is what we just kind of looked at together on a slide. And then after you're finished with the describe user, also modify describe group to be a method called describe that receives a group struct instead.