I'm playing around in the console, trying to understand prototypal inheritance. I'm familiar with classical inheritance, but I've never used any inheritance in my JS work.
If I have:
var foo = {
cat: "oliver"
}
var bar = Object.create(foo);
foo.prototype = {
dog: "rover"
}
When I do:
dir(bar.dog)
or
dir(foo.dog)
I expect to see rover
but they both come back as undefined
.
What am I missing?
Thanks in advance.