But the proto object(s) can also have properties so a puppy has a spine (like the in the examples) which can be looked up on the proto
You can use hasOwnProperty() to check if the property is on the specific object or looked up in the proto chain
Emmanuel Hernandez
@ManuH
hey guys, I have a question about the exercise, the function "hasOwnProperty" is already defined?
Alexis Abril
@alexisabril
@ManuH Yep. “hasOwnProperty” is a method that exists on the Object.prototype.
Lotfi Harrabi
@lotfire
@ManuH yes
Emmanuel Hernandez
@ManuH
nice, thanks
Emmanuel Hernandez
@ManuH
module('new, dot, and dotcall'); test('DOT', function(){ var person = new Person('Alexis'); var species = DOT(person, 'species'); equal(species, 'Homo Sapien', 'property accessed');
what is 'equal'?
Alexis Abril
@alexisabril
@ManuH equal, deepEqual and ok are all QUnit assertion methods. We have a set of tests in the html just to validate the exercises
Emmanuel Hernandez
@ManuH
cool thanks
Alexis Abril
@alexisabril
np!
Emmanuel Hernandez
@ManuH
I'm still trying to do the DOTCALL
but I don't get what's supposed to do
Alexis Abril
@alexisabril
@ManuH DOTCALL simulates invoking a method on an object. For example:
person.speak(); //invokes the speak method, which may exist anywhere on the prototype, but uses “person” as “this”.
DOTCALL(person, ‘speak’); //will do the same as above
Imanuel Gittens
@imanuelgittens
Hi guys. I'm learning a lot from your training.
You're awesome
I'm trying to make the DOT function and I wanted some direction.
I'm thinking that to walk the proto chain, there must be some kind of loop involved
however i don't know when that loop should end
should it end when proto is equal to the window object?