Transcript from the "Object.create" Lesson
[00:00:30] Whenever we pass through it, now, well, in this case is always gonna store on the left hand side an empty object. Let's do it, user 3 is therefore gonna be in memory an empty object, there it is. Into which we're gonna store our properties name, Eva, score 9, and again, our increment method.
[00:00:59] So there it is, our user 3 object. We created it using this interesting built-in tool for creating objects object-dot-create. Very explicitly named. Whatever we pass to that always it returns out an empty object. I could pass in objects full of objects no problem, empty object, but what we pass in is gonna determine, we're gonna see, what bonus feature we might get access to, with user 3 if we pass in something more interesting than null.
[00:01:32] All to come, but note folk. What have we done? We've started building our application. We have an object representing user 3, we have an object representing user2. Both of these objects have all the pertinent functionality that is applicable to Eva, applicable to Julia, but we're handcrafting these objects.
[00:01:57] We're sticking properties in there manually one by one, and we don't have a bunch of developers sitting behind the scenes when you sign up to a site, or log in, and say, don't worry, don't worry, Terry's logged in. Get the object created. No, no, no, no. We have a function that will then allow us to call it when the user logs in, and fill out the object at that moment.
[00:02:23] Whenever we have repetitive code, we do not want to be doing it from scratch every time. So we wrap this work in a function. And it turns out, people, this ends up being our first solution.