I am trying to get the keys to a JavaScript object. When I check the object, I see that there are a couple of key values on the object, but when I start Object.keys(myObject), I get an empty array. What am I doing wrong?

I follow this documentation here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
And the function that creates the object is as follows:
query: function () {
var query = {}
_.each(this.$el.find('input:checked'), function (el, index) {
Object.defineProperty(query, el.id, {value: el.value})
})
return query
}
source
share