Dressed to Impress


#1

So in the instructions, Codacademy references this:

Recall that obj.hasOwnProperty('propertyName') will return true or false based on whether or not obj has the >propertyName property.

When am I supposed to recall this from? This is the first time I have seen this property!

This kind of thing drives me crazy!


#2

There is a first time for everything. Relish in it. Look back on it and learn from it.

    var obj = {
        foo: "me a foo",
        bar: "me a bar"
    }
    var foo = obj.hasOwnProperty('foo')
    if (foo) {
        console.log(obj.foo);
    }
    var bar = obj.hasOwnProperty('bar')
    if (bar) {
        console.log(obj.bar);
    }

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.