-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
Write a factory function that accepts a baseUrl as parameter, and returns an object having get and post functions, which get and post an endpoint respectively.
Try to understand it's similarities to a class-based version, which accepts a baseUrl in the constructor and has two get and post methods. Most of the times, you can swap a class for a factory function, and vice versa.
Factory function is a very powerful tool for a Javascript developer. So, try to play with it for a while, in addition to finishing merely this task.
What to google
- Javascript factory functions (note that it has nothing to do with factory method design pattern)
- Javascript closures (just give it a look, it's an advanced - though fundamental - JS feature)
Suggested resources
Metadata
Metadata
Assignees
Labels
No labels