Of course not all methods in lodash are baked into core javaScipt itself, and some that are do sometimes bring a bit more to the table, but _.create is not the best example of this. So because I do not feel like writing one post for _.create, and another for Object.create I will be sort of blending things together here, and just be writing mostly about the nature of the method itself, regardless if it is native or not.
So for starters if I have an object that contains methods and I want to use those methods with an object there are a number of ways to go about doing that. If the methods are designed in a way in which they could be part of an objects prototype I can use something like Function.call, or another way would be to use _.create to make it so the object of methods is the prototype object of the object that I want to use with the methods.
Doing this differs from just making the method part of the object to begin with. For one thing if I where to make a whole bunch of objects with object.create, they will end up taking up less memory because they would all share the same set of methods. This also differs from making just a reference to the methods object as well because doing so would be defining a method as one of the actual own properties of the object rather than it’s prototype. As prototype methods can act as a default of sorts if the method is not define in the own properties of the object.
Another useful method to be aware of when it come to learning a thing or two about the various ways to go about creating an object would be the get prototype of object method. As the name suggests this is what can be used to get and return the prototype object of any object.
In order to give the _.create method justice I will also need to get into the concept of the prototype object in detail. However that is a matter for another post, in a whole other category, for now hopefully this post will help shed some like on the subject of the lodash create method, and its native counterpart.
If you enjoyed this post and think that you got something out of it you might want to check out one of my many other posts on lodash. When it comes to working with objects in general there are a whole lot of other lodash methods, and corresponding native alternatives to be aware of. Just a few good examples would be the lodash clone, and lodash clone deep methods when it comes to the topic of creating copies of objects.