Use strict mode and use a safer for loop

We want to check to make sure that the property we're looking at is actually from the object, not from its prototype.